0

I'm using Apache 2.4 and several virtual hosts. This is on Windows, BTW. Within each virtual host, I have the following log file configurations:

CustomLog "|bin/rotatelogs.exe -l ${SRVROOT}/logs/dev.ssl_request.%Y.%m.%d.log 86400" \
      "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" env=HTTPS

ErrorLog "|bin/rotatelogs.exe -l ${SRVROOT}/logs/dev.error.%Y.%m.%d.log 86400"
TransferLog "|bin/rotatelogs.exe -l ${SRVROOT}/logs/dev.access.%Y.%m.%d.log 86400"

That would be for the DEV virtual host. The others (test/ua/etc.) are basically the same except for the ServerName and logs are named {environment}.error, etc.

Now, when I start up Apache, the error log file gets hammered with the exact same message over and over. That message is:

Incorrect number of arguments
Usage: C:\Program Files\Apache Software Foundation\Apache24\bin\rotatelogs.exe [-v] [-l] [-L linkname] [-p prog] [-f] [-t] [-e] [-n number] <logfile> {<rotation time in seconds>|<rotation size>(B|K|M|G)} [offset minutes from UTC]

Add this:

TransferLog "|C:\Program Files\Apache Software Foundation\Apache24\bin\rotatelogs.exe /some/where 86400"

or 

TransferLog "|C:\Program Files\Apache Software Foundation\Apache24\bin\rotatelogs.exe /some/where 5M"

to httpd.conf. By default, the generated name will be
<logfile>.nnnn where nnnn is the system time at which the log
nominally starts (N.B. if using a rotation time, the time will
always be a multiple of the rotation time, so you can synchronize
cron scripts with it). If <logfile> contains strftime conversion
specifications, those will be used instead. At the end of each
rotation time or when the file size is reached a new log is
started.

Options:
  -v       Verbose operation. Messages are written to stderr.
  -l       Base rotation on local time instead of UTC.
  -L path  Create hard link from current log to specified path.
  -p prog  Run specified program after opening a new log file. See below.
  -f       Force opening of log on program start.
  -t       Truncate logfile instead of rotating, tail friendly.
  -e       Echo log to stdout for further processing.

The program is invoked as "[prog] <curfile> [<prevfile>]"
where <curfile> is the filename of the newly opened logfile, and
<prevfile>, if given, is the filename of the previously used logfile.

I cannot figure out why this is happening. Also, before I put Apache on our web server, I ran the exact same setup locally on my laptop and the logging worked without error messages.

Any ideas?

Thanks.

UPDATE

As suggested by Jeff Snider, I went one step further and removed the "${SRVROOT}" and changed everything to "logs/dev.error....". I read in the Apache docs that if you don't specify a / then it defaults to SRVROOT anyway.

After I did that I started seeing some logs pop up. And, the error log was stable. But, after a few minutes it started happening again.

I even disabled ALL "TransferLog"'s in each environment and only have the CustomLog and ErrorLog. Same thing.

My current config is now:

CustomLog "|bin/rotatelogs.exe -l logs/dev.ssl_request.%Y.%m.%d.log\ 86400" \
      "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" env=HTTPS

ErrorLog "|bin/rotatelogs.exe -l logs/dev.error.%Y.%m.%d.log 86400"
1

Try putting quotes around ${SRVROOT} in your command lines. I suspect that has spaces and those might confuse it by looking like several separate arguments.

4
  • That actually helped but the problem still remains. See my edit above. – cbmeeks Oct 19 '17 at 15:50
  • Your current config on the CustomLog line reads ...%d.log\ 86400"... That backslash may be causing trouble now. – Jeff Snider Oct 19 '17 at 16:53
  • Ah, I didn't notice that. I will try that out. Thanks. – cbmeeks Oct 19 '17 at 17:19
  • The log\ 86400 error seemed to do the trick. Thanks. – cbmeeks Oct 20 '17 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.