jasonmanley87

Logrotate help!

4 posts in this topic

Hello. I implemented a logrotate script for haproxy on our servers, and it seems it is not doing the behavior I had hoped for. Let me explain:

09:59:24 # ls /var/log -l | grep haproxy

-rw------- 1 root root 0 Feb 10 04:02 haproxy.log

-rw------- 1 root root 75117061 Feb 10 09:59 haproxy.log-20120210

The second file below is the one growing in size with each transaction going through our system. I want the FIRST one to be where current transactions go.

Here is my logrotate script, placed in of course /etc/logrotate.d/haproxy :

/var/log/haproxy.log {

daily

rotate 1000

dateext

}

What am I doing wrong? Logrotate is already set as a daily cron job.

0

Share this post


Link to post
Share on other sites

Hello. I implemented a logrotate script for haproxy on our servers, and it seems it is not doing the behavior I had hoped for. Let me explain:

09:59:24 # ls /var/log -l | grep haproxy

-rw------- 1 root root 0 Feb 10 04:02 haproxy.log

-rw------- 1 root root 75117061 Feb 10 09:59 haproxy.log-20120210

The second file below is the one growing in size with each transaction going through our system. I want the FIRST one to be where current transactions go.

Here is my logrotate script, placed in of course /etc/logrotate.d/haproxy :

/var/log/haproxy.log {

daily

rotate 1000

dateext

}

What am I doing wrong? Logrotate is already set as a daily cron job.

The daily line in your logrotate config file will make logrotate create a new file with the date at the end every day. After looking at the man page i could not find "dateext", but I imagine it is a correct value in your version of logrotate. I would think that dateext means that the log file is saved with the date as the extension... You need to take a look at the log rotate man page if you plan to fix your problem.

Not really sure how you plan to have someone else fix this for you... just follow the man page.

http://linuxcommand.org/man_pages/logrotate8.html

0

Share this post


Link to post
Share on other sites

Do you think the 'copytruncate' option in the logrotate script would have the correct effect? I'll test it at work tomorrow.

0

Share this post


Link to post
Share on other sites

I think it will do something similar to what you are trying to accomplish, but I don't think it will change the output of what you are trying to ammend. The whole point of log rotate is to rotate logs out periodically to archive and organize; and consequently rename archived files. You could just disable log rotate on that log file and it will not be renamed.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now