LinuxQuestions.org
Help answer threads with 0 replies.
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 01-05-2005, 08:14 AM   #1
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 807

Rep: Reputation: 84
Unhappy Logs are not rotated


Hey all,

Running Slack 10, kernel 2.4.28 on my laptop. I noticed that my logs are not rotating. /var/log/messages and /var/log/syslog are over 1Mb now, and the starting date is when I did a reinstall last year November.
After reading several posts, I checked the following and couldn't find anything wrong:

* No logs have passed the 2G limit, which would stop all logging.
Code:
root@leon-fyg:/home/leon# ps ax | grep syslogd
   69 ?        Ss     0:00 /usr/sbin/syslogd
 1873 pts/1    S+     0:00 grep syslogd
root@leon-fyg:/home/leon#
Code:
cat /var/lib/logrotate/status
logrotate state -- version 2
"/var/log/cron" 2005-1-4
"/var/log/debug" 2005-1-4
"/var/log/maillog" 2005-1-4
"/var/log/messages" 2005-1-4
"/var/log/secure" 2005-1-4
"/var/log/spooler" 2005-1-4
"/var/log/syslog" 2005-1-4
"/var/log/wtmp" 2005-1-4
So all logs were 'attempted' to be rotated
When I start logrotate from console I get
Code:
root@leon-fyg:/home/leon# logrotate -d /etc/logrotate.conf
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file syslog
reading config info for /var/log/cron /var/log/debug /var/log/maillog /var/log/m
essages /var/log/secure /var/log/spooler /var/log/syslog 
reading config info for /var/log/wtmp 

Handling 2 logs

rotating pattern: /var/log/cron /var/log/debug /var/log/maillog /var/log/message
s /var/log/secure /var/log/spooler /var/log/syslog  weekly (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/cron
  log does not need rotating
considering log /var/log/debug
  log does not need rotating
considering log /var/log/maillog
  log does not need rotating
considering log /var/log/messages
  log does not need rotating
considering log /var/log/secure
  log does not need rotating
considering log /var/log/spooler
  log does not need rotating
considering log /var/log/syslog
  log does not need rotating
not running shared postrotate script, since no logs were rotated

rotating pattern: /var/log/wtmp  monthly (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/wtmp
  log does not need rotating
root@leon-fyg:/home/leon#
Code:
root@leon-fyg:/home/leon# less /etc/logrotate.conf
# /etc/logrotate.conf
#
# logrotate is designed to ease administration of systems that generate large
# numbers of log files.  It allows automatic rotation, compression, removal, and
# mailing of log files.  Each log file may be handled daily, weekly, monthly, or
# when it grows too large.
#
# logrotate is normally run daily from root's crontab.
#
# For more details, see "man logrotate".

# rotate log files weekly:
weekly

# keep 4 weeks worth of backlogs:
rotate 4

# create new (empty) log files after rotating old ones:
create

# uncomment this if you want your log files compressed:
#compress

# some packages install log rotation information in this directory:
include /etc/logrotate.d

# Rotate /var/log/wtmp:
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

# Note that /var/log/lastlog is not rotated.  This is intentional, and it should
# not be.  The lastlog file is a database, and is also a sparse file that takes
# up much less space on the drive than it appears.

# system-specific logs may be also be configured below:

root@leon-fyg:/home/leon#
Code:
root@leon-fyg:/home/leon# cat /etc/logrotate.d/syslog 
/var/log/cron /var/log/debug /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler /var/log/syslog {
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2>/dev/null` 2>/dev/null || true
    endscript
}
root@leon-fyg:/home/leon#
Sorry for the long post, but hopefully I've provided enough configs etc for someone to detect why the logs are not rotated by cron.daily.

Cheers, Leon.
 
Old 01-05-2005, 01:55 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 243Reputation: 243Reputation: 243
Why did you use the -d switch for logrotate ?

man logrotate :

-d Turns on debug mode and implies -v. In debug mode,
no changes will be made to the logs or to the
logrotate state file.
 
Old 01-06-2005, 05:17 AM   #3
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 807

Original Poster
Rep: Reputation: 84
Quote:
Originally posted by Cedrik
Why did you use the -d switch for logrotate ?
To be honest, I just copied that from another thread.
When I leave the -d, the logs aren't rotated either:
Code:
bash-3.00# logrotate -v /etc/logrotate.conf 
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file syslog
reading config info for /var/log/cron /var/log/debug /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler /var/log/syslog 
reading config info for /var/log/wtmp 

Handling 2 logs

rotating pattern: /var/log/cron /var/log/debug /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler /var/log/syslog  weekly (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/cron
  log does not need rotating
considering log /var/log/debug
  log does not need rotating
considering log /var/log/maillog
  log does not need rotating
considering log /var/log/messages
  log does not need rotating
considering log /var/log/secure
  log does not need rotating
considering log /var/log/spooler
  log does not need rotating
considering log /var/log/syslog
  log does not need rotating
not running shared postrotate script, since no logs were rotated

rotating pattern: /var/log/wtmp  monthly (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/wtmp
  log does not need rotating
bash-3.00#
What am I missing here???
 
Old 01-06-2005, 07:06 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 243Reputation: 243Reputation: 243
could you post the output of :
ls -al /var/log/messages*
 
Old 01-06-2005, 07:26 AM   #5
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 807

Original Poster
Rep: Reputation: 84
Quote:
Originally posted by Cedrik
could you post the output of :
ls -al /var/log/messages*
leon@leon-fyg:~$ la /var/log/messages*
-rw-r----- 1 root root 1.3M Jan 6 15:27 /var/log/messages
leon@leon-fyg:~$
 
Old 01-06-2005, 07:34 AM   #6
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 243Reputation: 243Reputation: 243
did you try the -f option ?

logrotate -f -v /etc/logrotate.conf
 
Old 01-06-2005, 07:48 AM   #7
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 807

Original Poster
Rep: Reputation: 84
Quote:
Originally posted by Cedrik
did you try the -f option ?

logrotate -f -v /etc/logrotate.conf
YES! Forcing it does the job. But why doesn't it work normally...
Maybe after this one time forced logrotate it will do it automatically during future cron jobs?
If not, would it be a bad idea to add the -f to the cron.daily logrotate script?

Thanks a lot!

Cheers, Leon.
 
Old 01-06-2005, 08:02 AM   #8
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 243Reputation: 243Reputation: 243
I think logrotate use the infos provided by /var/lib/logrotate/status to know if rotate logs are needed, so I would
think that if you let it be, it will rotate the logs after a period of time
 
Old 01-06-2005, 08:19 AM   #9
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 807

Original Poster
Rep: Reputation: 84
Cedrik,

thanks for your help!

Cheers, Leon.
 
Old 01-08-2005, 01:12 AM   #10
Hans Zarkoff
Member
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 58

Rep: Reputation: 15
Wow, I must have been sleeping for the last 10 years! Here's what I've been doing for a log rotation. No one asked me for this, but maybe it'll help someone do something.

#!/bin/bash

tmp="/var/log/messages".`date +"%m%d%H%M%Y"`
/bin/cp /var/log/messages $tmp
/bin/cat /dev/null > /var/log/messages
 
Old 01-11-2005, 08:41 AM   #11
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 807

Original Poster
Rep: Reputation: 84
Quote:
Originally posted by Cedrik
I think logrotate use the infos provided by /var/lib/logrotate/status to know if rotate logs are needed, so I would think that if you let it be, it will rotate the logs after a period of time
For completeness of the thread: yes indeed cron now rotates the logs automatically!

Cheers, Leon.
 
Old 06-03-2009, 06:49 PM   #12
fschroder
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 0
Although very old this msg helped me, so I thought about contributing.

Quote:
I think logrotate use the infos provided by /var/lib/logrotate/status to know if rotate logs are needed, so I would think that if you let it be, it will rotate the logs after a period of time
It only worked with the -f option for me too, until I tweaked the info stored in /var/lib/logrotate.status. I had to set the log date to a previous date for it to start working.
 
  


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 error - last rotated in the future ocgltd Fedora 1 10-02-2005 08:07 PM
Rotated monitor(s) with Xorg 6.8.1 dnar Linux - Hardware 0 01-09-2005 07:39 AM
Firewall logs in logs and terminal... robbow52 Debian 7 11-20-2004 07:13 PM
Firefox logs user out? Where are error logs? case1984 Linux - General 0 10-09-2004 02:22 PM
Separate firewall logs and general logs dominant Linux - General 3 04-20-2004 01:26 AM

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

All times are GMT -5. The time now is 04:20 AM.

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