LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-03-2014, 12:05 PM   #1
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 518

Rep: Reputation: 32
do I need to add entry to logrotate?


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?
 
Old 03-05-2014, 07:45 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,940
Blog Entries: 13

Rep: Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981
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.

What did you end up doing or concluding?
 
Old 03-09-2014, 01:57 PM   #3
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 518

Original Poster
Rep: Reputation: 32
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.

Cheers
 
Old 03-10-2014, 07:05 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,940
Blog Entries: 13

Rep: Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981Reputation: 4981
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.
 
Old 03-10-2014, 08:13 AM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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):
Code:
/var/log/ntp.log {
  rotate 10
  notifempty
  missingok
  compress
  delaycompress
  sharedscripts
  postrotate
    /etc/rc.d/rc.ntpd restart
  endscript
}
As of right now, the logs look like this:
Code:
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?

Hope this helps some.
 
Old 03-11-2014, 01:56 AM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,860

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
Quote:
Originally Posted by plisken View Post
is there a default "rule" for logs that reside in /var/log and have no specific entry in the logrotate file?
The contents of /etc/logrotate.d are used to handle various log files but there's no default for random files in /var/log or its subdirectories.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
logrotate duplicate log entry problem dman777 Linux - Software 3 01-01-2011 03:01 PM
New logrotate entry help investmentbnker75 Linux - Server 0 10-16-2008 09:02 PM
Add route entry ust Linux - Newbie 5 09-04-2008 09:43 PM
add entry to startup? TomalakBORG SUSE / openSUSE 1 11-22-2005 05:53 PM
How to add my log files in logrotate Groucho Slackware 2 10-03-2003 08:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration