Log rotation

Advertisement

Leifus
Guest

Log rotation

Hi,

I recently made a script for some automatic file transfers and enabled logs on it, but I have a problem that the rotation does not delete the old files, so they get quite large.
My current log part looks like this:
/log="D:\******\******\******\!D-!M-!Y-*******.log" /logsize=3*80M
I have a feeling it could be the date argument, but I am not sure. Could anyone help me with this?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,506
Location:
Prague, Czechia

Re: Log rotation

Do you have the latest version of WinSCP?

Works for me. Without the 3* limitation:
winscp.com /ini=nul /log=!D-!M-!Y.log /script=script.txt /logsize=50K
dir *log*
I get these 6 logs:
10.12.2021  11:01            10 354 10-12-2021.log
10.12.2021  11:01            51 185 10-12-2021.log.1
10.12.2021  11:01            51 196 10-12-2021.log.2
10.12.2021  11:01            51 168 10-12-2021.log.3
10.12.2021  11:01            51 129 10-12-2021.log.4
10.12.2021  11:01            51 171 10-12-2021.log.5
With the same script with the log count limitation:
winscp.com /ini=nul /log=!D-!M-!Y.log /script=script.txt /logsize=3*50K
dir *log*
I get only 4 logs, as expected:
10.12.2021  11:05            41 680 10-12-2021.log
10.12.2021  11:05            51 117 10-12-2021.log.1
10.12.2021  11:05            51 156 10-12-2021.log.2
10.12.2021  11:05            51 196 10-12-2021.log.3

Reply with quote

Leifus
Guest

Re: Log rotation

I think the reason is that the logfile gets about 80M a day, and since it's a unique name for each day it does not count as a rotation? Might be wrong, but I do think the date thing is messing it up since i made it do 1 log for 1 day, so might have to change the file name.

Thanks for the response tho

Reply with quote

martin
Site Admin
martin avatar

Re: Log rotation

The time patterns in the log name are resolved only once. So even if your script runs more than once day, the log names won't change.
Though if you run the script once a day, then indeed the log rotation won't happen.

Reply with quote

Advertisement

You can post new topics in this forum