plecos / logrotatewin

This is a Windows implementation of the logrotate utility found in Linux platforms. The goal is to use the same command line parameters and files as the Linux version.
GNU General Public License v3.0
120 stars 43 forks source link

logrotate: Exception: Illegal characters in path. #25

Open ghost opened 6 years ago

ghost commented 6 years ago

So I posted this over on SF as well but I get the feeling the conversation/development moved over to GH.

Anyways I exit with an illegal error using 0.18:

C:\Program Files (x86)\Ken Salter\LogRotate> logrotate.exe -v D:\logrotate.conf logrotate: logrotate 0.0.0.18 - Copyright (C) 2012-2016 Ken Salter logrotate: Verbose option set to true logrotate: D:\logrotate.conf Adding to config files to process logrotate: Parsing configuration file D:\logrotate.conf logrotate: Processing new section logrotate: Will process file path d:\syslog_ng\syslog logrotate: Processing d:\syslog_ng\syslog logrotate: Processing d:\syslog_ng\syslog_1.2.3.4 logrotate: Processing d:\syslog_ng\syslog_2 logrotate: Processing d:\syslog_ng\syslog_connect logrotate: Processing d:\syslog_ng\syslog_GET logrotate: Processing d:\syslog_ng\syslog_server-1-2 logrotate: Processing d:\syslog_ng\syslog_server-2-3.a.b.d logrotate: Processing d:\syslog_ng\syslog_xrGetServerVersion0 logrotate: Processing d:\syslog_ng\syslog_xsGetComputerName0 logrotate: Rotating file d:\syslog_ng\syslog_1.2.3.4 logrotate: Exception: Illegal characters in path. logrotate: StackTrace: at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boo lean expandShortPaths) at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths) at System.IO.Path.GetFullPathInternal(String path) at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) at System.IO.Directory.CreateDirectory(String path) at logrotate.Program.GetRotatePath(logrotateconf lrc, FileInfo fi) at logrotate.Program.RotateFile(logrotateconf lrc, FileInfo fi) at logrotate.Program.Main(String[] args)

---------- conf file -----------------------

compress daily rotate 181 maxage 181 nomail

"d:\syslog_ng\syslog*" { sharedscripts missingok ifempty dateext olddir "d:\syslog_ng_archive" firstaction net stop syslog-ng endscript lastaction net start syslog-ng endscript }

61131 commented 6 years ago

@peter-thoenen - At first glance (and without running any testing locally myself), I would say that the \s in your olddir configuration directive is being interpreted (and in turn, this path is not being seen as existent when logrotate is run). To confirm or refute my suspicions, can you please try defining olddir as follows:

olddir "d:\\syslog_ng_archive"

ghost commented 6 years ago

Not it but it put me on the right track. Delimiting the backslash didn't change anything nor did delimiting the underscore or colon. I did remove the quotations though completely and it all worked fine (well this issue at least lol); not sure what one would do though if the olddir path had spaces in it though as I assume quotes would be needed.

Regardless both your suggestion and my workaround run afoul of the example given in:

https://sourceforge.net/p/logrotatewin/wiki/LogRotate/