Jump to content


Photo
- - - - -

Logrotate help!


  • Please log in to reply
3 replies to this topic

#1 jasonmanley87

jasonmanley87

    I broke 10 posts and all I got was this lousy title!

  • Members
  • 19 posts
  • Gender:Male

Posted 10 February 2012 - 11:11 AM

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.

#2 Alk3

Alk3

    "I Hack, therefore, I am"

  • Binrev Financier
  • 1,003 posts
  • Gender:Not Telling
  • Location:312 Chi-town

Posted 11 February 2012 - 10:45 AM

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....logrotate8.html

#3 jasonmanley87

jasonmanley87

    I broke 10 posts and all I got was this lousy title!

  • Members
  • 19 posts
  • Gender:Male

Posted 12 February 2012 - 12:06 PM

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

#4 Alk3

Alk3

    "I Hack, therefore, I am"

  • Binrev Financier
  • 1,003 posts
  • Gender:Not Telling
  • Location:312 Chi-town

Posted 12 February 2012 - 04:28 PM

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.




BinRev is hosted by the great people at Lunarpages!