4

Recently I have implement apache 2.4.1 in my web server.The problem is the rotate logs seems to be not functioning.Here is the output in the error_log:

[core:error] [pid 13060:tid 47015847145408] (2)No such file or directory

The command line that i have put in the httpd.conf are such as below:

CustomLog "|bin/rotatelogs -l /var/log/logfile.%Y.%m.%d 86400" combined

Is there anything wrong here with my setup?For your information I've already tested it in apache 2.2.22 and everythings is perfectly working.

Thanks.

3 Answers 3

3

It looks like the user context you are running Apache under does not have rights to create a file in the /logs directory. You can validate this quickly by switching to the user that Apache is running under (sudo su - <username>) and running

touch /logs/testfile
1

Where is the rotatelogs binary located on your system?

You don't have a leading slash on your path, which doesn't seem intended - and the file not being found supports that. You're probably looking for something more along these lines:

CustomLog "|/bin/rotatelogs -l /var/log/logfile.%Y.%m.%d 86400" combined
4
  • On my CentOS6 box, it's /usr/sbin/rotatelogs, but that's part of the httpd-2.2 package. It's possible the OP compiled 2.4 himself and stashed it someplace like /usr/local/bin/rotatelogs or /usr/local/sbin.
    – cjc
    Mar 23, 2012 at 3:33
  • I 've already put the full path and tested it.Still not working and gives the same error.Here the command that i have put : CustomLog "|/usr/local/apache2/bin/rotatelogs /logs/logfile.%Y.%m.%d 86400" combined
    – newbie.my
    Mar 23, 2012 at 3:40
  • /logs/logfile? Does that path exist? Mar 23, 2012 at 3:42
  • Sorry my bad, I have changed into this one:CustomLog "|/usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/logfile.%Y.%m.%d 86400" and yet it still not working
    – newbie.my
    Mar 23, 2012 at 4:43
0

Use logrotate, which is included by default (if period is ok) https://fedorahosted.org/logrotate/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .