SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've in the past added many entries to the logrotate.conf file, normally to deal with web logs and such, even mail folders but I was wondering if I need to add an entry in this case.
I'm adding an ntp.log file and got me thinking, is there a default "rule" for logs that reside in /var/log and have no specific entry in the logrotate file?
That's hard to figure. (1) you marked this as solved. My personal preference is if you do self-resolve; do mark the thread as solved, but add another comment, or edit your original comment to indicate what you did to resolve it or understand it. (2) there are general rules which one can use, I actually don't use logrotate for system logs, but instead for application logs which are in a customized location on my systems. But you can use wildcards and specify all files in a given directory and such.
I should have deleted the post to be honest, but couldn't figure out how to, apologies...
Code:
/var/log/ntp.log {
size 200k
rotate 4
create
}
I guess my query was that if a logrotate rule didn't exist, then was there a default rule covering the default log location?
Example being that any logs or files which reside in /var/log would be rotated based on a max file size or something, should there not be a specific rule in the logrotate.conf file.
Was such a trivial point, that a few added lines as above just to be safe.
My understanding is that it will not do anything without a conf file; however one can specify a specific conf file or let it use /etc/logrotate.conf and there usually is a default conf file created; but I think it's more of an example versus.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Just to chime in, as a general rule I do not mess with .conf files unless I have a really, really good reason for doing so -- Slackware does a pretty good job of configuring stuff by default, methinks.
That being said, logroate does what you tell it in your files in /etc/logrotate.d and you can fancy those up to your heart's content. Rotate on size, rotate weekly irrespective of size, compress, don't compress, whatever.
Since you provided an example for NTP log rotation, here' another example (the one I use):
ls -l /var/log/ntp*
-rw-r--r-- 1 root root 1248 Mar 10 09:01 /var/log/ntp.log
-rw-r--r-- 1 root root 12002 Mar 10 04:40 /var/log/ntp.log.1
-rw-r--r-- 1 root root 1042 Mar 2 04:40 /var/log/ntp.log.2.gz
-rw-r--r-- 1 root root 1497 Feb 24 04:40 /var/log/ntp.log.3.gz
-rw-r--r-- 1 root root 619 Feb 16 04:40 /var/log/ntp.log.4.gz
That's what the delaycompress does; ntp.log.1 won't get compressed until next Sunday.
You can get some good hints just reading through the default rotate files provided with Slackware -- I'm not that smart, I cobbled together the NTP rotate file from one of the defaults, sneaky but effective, eh?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.