Is it possible to change the log file option when using the API?

What is the problem you are having with rclone?

Is it possible to change the log file option when using the API?

Run the command 'rclone version' and share the full output of the command.

rclone v1.57.0

  • os/version: Microsoft Windows Server 2019 Datacenter 1809 (64 bit)
  • os/kernel: 10.0.17763.2510 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.17.2
  • go/linking: dynamic
  • go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

N/A

The command you were trying to run (eg rclone copy /tmp remote:tmp)

curl --location --request POST 'https://localhost/options/local' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic cDpw' \
--data-raw '{
    "_config": {
        "Transfers": 64,
        "DryRun": true
    },
    "log": {
        "File": "C:\\rclone\\logs\\rclone.infpwfs1sa-apps.copy.log"
    }
}'

The rclone config contents with secrets removed.

[LocalDisk]
type = local

[aws]
type = s3
provider = AWS
access_key_id = 
secret_access_key = 
region = us-east-1
location_constraint = us-east-1

A log from the command with the -vv flag

Here are the results from the API call.

{
	"config": {
		"LogLevel": 6,
		"StatsLogLevel": 6,
		"UseJSONLog": false,
		"DryRun": true,
		"Interactive": false,
		"CheckSum": false,
		"SizeOnly": false,
		"IgnoreTimes": false,
		"IgnoreExisting": false,
		"IgnoreErrors": false,
		"ModifyWindow": 1,
		"Checkers": 8,
		"Transfers": 64,
		"ConnectTimeout": 60000000000,
		"Timeout": 300000000000,
		"ExpectContinueTimeout": 1000000000,
		"Dump": 0,
		"InsecureSkipVerify": false,
		"DeleteMode": 3,
		"MaxDelete": -1,
		"TrackRenames": false,
		"TrackRenamesStrategy": "hash",
		"LowLevelRetries": 10,
		"UpdateOlder": false,
		"NoGzip": false,
		"MaxDepth": -1,
		"IgnoreSize": false,
		"IgnoreChecksum": false,
		"IgnoreCaseSync": false,
		"NoTraverse": false,
		"CheckFirst": false,
		"NoCheckDest": false,
		"NoUnicodeNormalization": false,
		"NoUpdateModTime": false,
		"DataRateUnit": "bytes",
		"CompareDest": null,
		"CopyDest": null,
		"BackupDir": "",
		"Suffix": "",
		"SuffixKeepExtension": false,
		"UseListR": false,
		"BufferSize": 16777216,
		"BwLimit": "",
		"BwLimitFile": "",
		"TPSLimit": 0,
		"TPSLimitBurst": 1,
		"BindAddr": "",
		"DisableFeatures": null,
		"UserAgent": "rclone/v1.57.0",
		"Immutable": false,
		"AutoConfirm": false,
		"StreamingUploadCutoff": 102400,
		"StatsFileNameLength": 45,
		"AskPassword": true,
		"PasswordCommand": null,
		"UseServerModTime": false,
		"MaxTransfer": -1,
		"MaxDuration": 0,
		"CutoffMode": 0,
		"MaxBacklog": 10000,
		"MaxStatsGroups": 1000,
		"StatsOneLine": false,
		"StatsOneLineDate": false,
		"StatsOneLineDateFormat": "",
		"ErrorOnNoTransfer": false,
		"Progress": false,
		"ProgressTerminalTitle": false,
		"Cookie": false,
		"UseMmap": false,
		"CaCert": "",
		"ClientCert": "",
		"ClientKey": "",
		"MultiThreadCutoff": 262144000,
		"MultiThreadStreams": 4,
		"MultiThreadSet": false,
		"OrderBy": "",
		"UploadHeaders": null,
		"DownloadHeaders": null,
		"Headers": null,
		"RefreshTimes": false,
		"NoConsole": false,
		"TrafficClass": 0,
		"FsCacheExpireDuration": 300000000000,
		"FsCacheExpireInterval": 60000000000,
		"DisableHTTP2": false,
		"HumanReadable": false,
		"KvLockTime": 1000000000
	},
	"filter": {
		"DeleteExcluded": false,
		"FilterRule": null,
		"FilterFrom": null,
		"ExcludeRule": null,
		"ExcludeFrom": null,
		"ExcludeFile": "",
		"IncludeRule": null,
		"IncludeFrom": null,
		"FilesFrom": null,
		"FilesFromRaw": null,
		"MinAge": 9223372036854775807,
		"MaxAge": 9223372036854775807,
		"MinSize": -1,
		"MaxSize": -1,
		"IgnoreCase": false
	}
}

hello and welcome to the forum,

you want to set the location for the log file?

did you try logfile?

Hello,

Thanks for your help. I did try logfile, but the result was the same. I believe that only the options returned from the API call can be set via the API call, but I'm hoping I'm mistaken.

Command

curl --location --request POST 'https://rclone.hsag.com/options/local' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic cDpw' \
--data-raw '{
    "_config": {
        "Transfers": 64,
        "DryRun": true,
        "logfile": "C:\\rclone\\logs\\rclone.infpwfs1sa-apps.copy.log"
    }
}'

Result

{
	"config": {
		"LogLevel": 6,
		"StatsLogLevel": 6,
		"UseJSONLog": false,
		"DryRun": true,
		"Interactive": false,
		"CheckSum": false,
		"SizeOnly": false,
		"IgnoreTimes": false,
		"IgnoreExisting": false,
		"IgnoreErrors": false,
		"ModifyWindow": 1,
		"Checkers": 8,
		"Transfers": 64,
		"ConnectTimeout": 60000000000,
		"Timeout": 300000000000,
		"ExpectContinueTimeout": 1000000000,
		"Dump": 0,
		"InsecureSkipVerify": false,
		"DeleteMode": 3,
		"MaxDelete": -1,
		"TrackRenames": false,
		"TrackRenamesStrategy": "hash",
		"LowLevelRetries": 10,
		"UpdateOlder": false,
		"NoGzip": false,
		"MaxDepth": -1,
		"IgnoreSize": false,
		"IgnoreChecksum": false,
		"IgnoreCaseSync": false,
		"NoTraverse": false,
		"CheckFirst": false,
		"NoCheckDest": false,
		"NoUnicodeNormalization": false,
		"NoUpdateModTime": false,
		"DataRateUnit": "bytes",
		"CompareDest": null,
		"CopyDest": null,
		"BackupDir": "",
		"Suffix": "",
		"SuffixKeepExtension": false,
		"UseListR": false,
		"BufferSize": 16777216,
		"BwLimit": "",
		"BwLimitFile": "",
		"TPSLimit": 0,
		"TPSLimitBurst": 1,
		"BindAddr": "",
		"DisableFeatures": null,
		"UserAgent": "rclone/v1.57.0",
		"Immutable": false,
		"AutoConfirm": false,
		"StreamingUploadCutoff": 102400,
		"StatsFileNameLength": 45,
		"AskPassword": true,
		"PasswordCommand": null,
		"UseServerModTime": false,
		"MaxTransfer": -1,
		"MaxDuration": 0,
		"CutoffMode": 0,
		"MaxBacklog": 10000,
		"MaxStatsGroups": 1000,
		"StatsOneLine": false,
		"StatsOneLineDate": false,
		"StatsOneLineDateFormat": "",
		"ErrorOnNoTransfer": false,
		"Progress": false,
		"ProgressTerminalTitle": false,
		"Cookie": false,
		"UseMmap": false,
		"CaCert": "",
		"ClientCert": "",
		"ClientKey": "",
		"MultiThreadCutoff": 262144000,
		"MultiThreadStreams": 4,
		"MultiThreadSet": false,
		"OrderBy": "",
		"UploadHeaders": null,
		"DownloadHeaders": null,
		"Headers": null,
		"RefreshTimes": false,
		"NoConsole": false,
		"TrafficClass": 0,
		"FsCacheExpireDuration": 300000000000,
		"FsCacheExpireInterval": 60000000000,
		"DisableHTTP2": false,
		"HumanReadable": false,
		"KvLockTime": 1000000000
	},
	"filter": {
		"DeleteExcluded": false,
		"FilterRule": null,
		"FilterFrom": null,
		"ExcludeRule": null,
		"ExcludeFrom": null,
		"ExcludeFile": "",
		"IncludeRule": null,
		"IncludeFrom": null,
		"FilesFrom": null,
		"FilesFromRaw": null,
		"MinAge": 9223372036854775807,
		"MaxAge": 9223372036854775807,
		"MinSize": -1,
		"MaxSize": -1,
		"IgnoreCase": false
	}
}

ok, did not know you already tried that, it was worth a shot.

"The response will be a JSON blob in the body of the response.
This is formatted to be reasonably human readable."

so i would try a simple command, such as the equivalent of rclone version and check the json output

and if that does not work, no worries, someone more knowledge about the api should stop by soon.

I don't think you can change the log file as there is an open item for log rotation that doesn't exist.

Implement logrotate solution · Issue #2259 · rclone/rclone (github.com)

Couple fixes in there as well.

I think this should work, but it currently isn't implemented :frowning:

Do you want to fix it? I'll give you a walk through if you do!

100% yes, I would love to help. Point me in the right direction, and I'll get started (I'll try not to ask for too much handholding).

What needs to happen is that this line

Needs to change to use rc.AddOptionReload which has a callback which is called when the option block is changed. There is an example of that here

The Reload function needs to call InitLogging to restart the logging.

That's glossing over a few details like closing the old log file, but it should point you in the right direction!

That should also make things like changing the log format work etc.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.