The Apache Haus Forum

Advanced search  

News:

Welcome to Apache Haus Distribution Forum

Pages: [1]   Go Down

Author Topic: Issues using logrotate.exe  (Read 424 times)

simcax

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Issues using logrotate.exe
« on: April 03, 2020, 01:02:40 PM »

I am trying to use logrotate.exe like this:

ErrorLog "|c:/path/to/Apache/Apache24/bin/rotatelogs.exe -l C:/path/to/logs/error.%Y-%m-%d-%H-%M-%S.log 86400"

Currently it is on my own Windows 10, but I get the following in the eventlog, when starting the service:

The Apache service named  reported the following error:
>>> (OS 3)The path was not found.  : AH00089: Couldn't start ErrorLog process 'c:/path/to/Apache\\Apache24/bin/rotatelogs.exe -l C:/path/to/logs/error.log 86400'. 

And then in the next event log:
The Apache service named  reported the following error:
>>> AH00015: Unable to open logs     .

I am using the distribution: httpd-2.4.43-o111f-x86-vc15.zip

I have shifted to use the mod_log_rotate module, and that works - although not for my error logs. And I would very much like for them to be rotated as well, as we have standard naming with dates for all log files :-/

Any good ideas?
Logged

mario

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 598
Re: Issues using logrotate.exe
« Reply #1 on: April 03, 2020, 07:15:53 PM »

Where did you install apache?

C:\Apache24 or somewhere else?

Because the path is not correct

if it is C:\Apache24

Code: [Select]
ErrorLog "|bin/rotatelogs -l logs/error_log_%Y%m%d.txt 86400"
Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 870
Re: Issues using logrotate.exe
« Reply #2 on: April 03, 2020, 07:27:39 PM »

Assuming the path used is correct and we are being shown a sanitized one:

I wonder if this problem is the same as with mod_ext_filter (both create an external process) in that it fails with APR 1.7.0 or if you should be using all double backslashes all the way through that ErrorLog string of yours since Windows doesn't understand forward slashes as a path separator. I have only used mod_log_rotate and never logrotate.exe but it seems to me I remember seeing an example that used \\ on windows decades ago. So try;

ErrorLog "|c:\\path\\to\\Apache\\Apache24\\bin\\rotatelogs.exe -l C:\\path\\to\\logs\\error.%Y-%m-%d-%H-%M-%S.log 86400"

Let me know if that works. If not I will compile httpd-2.4.43-o111f-x86-vc15 that instead uses APR 1.6.5 that you can test and if that works, I will go back to apr 1.6.5 till the problem with 1.7.0 gets fixed.






Logged

simcax

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Re: Issues using logrotate.exe
« Reply #3 on: April 24, 2020, 08:29:44 AM »

Hi Gregg,

sorry about my lacking reply, I did not catch there had been replies to my post. I will try the double backslashes and give an update asap.
Logged

simcax

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Re: Issues using logrotate.exe
« Reply #4 on: April 27, 2020, 08:10:18 AM »

Assuming the path used is correct and we are being shown a sanitized one:

I wonder if this problem is the same as with mod_ext_filter (both create an external process) in that it fails with APR 1.7.0 or if you should be using all double backslashes all the way through that ErrorLog string of yours since Windows doesn't understand forward slashes as a path separator. I have only used mod_log_rotate and never logrotate.exe but it seems to me I remember seeing an example that used \\ on windows decades ago. So try;

ErrorLog "|c:\\path\\to\\Apache\\Apache24\\bin\\rotatelogs.exe -l C:\\path\\to\\logs\\error.%Y-%m-%d-%H-%M-%S.log 86400"

Let me know if that works. If not I will compile httpd-2.4.43-o111f-x86-vc15 that instead uses APR 1.6.5 that you can test and if that works, I will go back to apr 1.6.5 till the problem with 1.7.0 gets fixed.

Correct - the path was sanatized :-)

I have now tried several things - all of them directly in the httpd.conf, no variables, just plain text hardcoded:
1. Double backslashes for both rotatelogs.exe and the log file path
2. Double backslashes for rotatelogs.exe and single backslashes for the log file path
3. Single backslashes for rotatelogs.exe and double backslashse for the log file path
4. Single backslashes for both rotatelogs.exe and the log file path
5. With and without .%Y-%m-%d-%H-%M-%S in the log filename

All of them write the same two errors in the event log.
1:
The Apache service named  reported the following error:
>>> (OS 2)The specified file was not found.  : AH00089: Couldn't start ErrorLog process 'c:\\path\\to\\the\\Apache24\\bin\\rotatelogs.exe -l c:\\path\\to\\logdir\\logs\\error.%Y-%m-%d-%H-%M-%S.log 86400'.     .
2:
The Apache service named  reported the following error:
>>> AH00015: Unable to open logs     .

Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 870
Re: Issues using logrotate.exe
« Reply #5 on: April 29, 2020, 12:14:13 AM »

Well, it's not a problem in APR 1.7 like the problem with that apr & mod_ext_filter (which works with apr 1.6).
I built 2.4.43 with apr 1.6.5 and got the same error at startup that you do.

I decided to try Apache 2.2 (apr 1.5), while I do not get that error (unless I point to a rotatelogs.exe that doesn't exist).
However, I get no 404, 403 or 500 errors, it doesn't even create a log file at startup as it is documented with -f.

Adding a CustomLog line to check it, it keeps spawning a new process over and over and over but the processes do not stick around. So I think it just simply doesn't work on Windows, or maybe just Windoze 10 which I was testing with.

I might just stop building/including it. If someone actually uses it I'd expect some disturbance in the force which would eventually lead to someone asking why it's no longer included which then I ask questions of how the heck did they get it working.





Logged

simcax

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Re: Issues using logrotate.exe
« Reply #6 on: April 30, 2020, 06:23:04 AM »

That is really weird. I will try it out on a Windows 2016 server, and see if there should be some sort of difference to windows 10.
Logged
Pages: [1]   Go Up
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13