LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to roll logs automatically?? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-roll-logs-automatically-344820/)

samd 07-19-2005 09:54 PM

How to roll logs automatically??
 
Hello all,
Does anyone know how I should go about rolling logfiles automatically?? I have several logs that I do not want to purge, but do want to archive in some fashion. What would be a good procedure to roll the logs. Possibly have them roll automatically via script out of a crontab. I am still green to linux, but picking it up quick. I am willing to dive into a heavy script if i could have some direction.

-sam

Tinkster 07-19-2005 10:33 PM

Why re-invent the wheel? :} ... chances are you have to
logrotate already installed, and just need to modify it a
bit for your needs?

samd 07-20-2005 04:45 PM

do you know what the module name is? and where it may be.....on RH9 standard install?

thanks, sam

oneandoneis2 07-20-2005 05:04 PM

Depending on what syslog you use, it may even be a built-in function. I use metalogger, which keeps logs separate by itself. . .

jrdioko 07-20-2005 08:14 PM

The way I understand it, it's pretty standard on most systems. Try "whereis logrotate" to see if you have it and "man logrotate" to see how to use it.

ciscohead 07-27-2005 12:32 PM

logrotating directories
 
I have virtual servers and each virtual has its own serverlog. I keep all the serverlogs in a directory. If I specify the whole directory what will happen?

ciscohead 07-27-2005 12:50 PM

specifically.....
 
I have read man logrotate but it is not clear how to do directories.

here is the additional conf block I made

#webserver access logs
/usr/local/apache/logs {
rotate 5
size=100k
sharedscripts
postrotate
/sbin/killall -HUP httpd
endscript
}

Here is what came back:
rotating pattern: /usr/local/apache/logs 102400 bytes (5 rotations)
empty log files are rotated, old logs are removed
not running shared postrotate script, since no logs were rotated

and the logs were unchanged. :cry: I definitely have some over 100K, they're killing my diskspace
How can I clear out the ancient dreck, while keeping the last few weeks or so.

Thanks for any hlp!


All times are GMT -5. The time now is 10:43 PM.