LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-08-2016, 08:16 AM   #1
pradeepspa
Member
 
Registered: Oct 2015
Posts: 79

Rep: Reputation: Disabled
Logrotate Not Rotating


Hi All,

I know there is multiple threads of same issue but none suits my issue.

My logrotate of a log file doesnt work even if I do manually.

Quote:
/var/log/Toronto-Log


{
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

And the logrotate.conf,
Quote:
# see "man logrotate" for details
# rotate log files weekly
daily

# keep 4 weeks worth of backlogs
rotate 0

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

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}



When I do logrotate -d /etc/logrotate.conf,
Quote:
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file ConsoleKit
reading config info for /var/log/ConsoleKit/history
reading config file dracut
reading config info for /var/log/dracut.log
reading config file iscsiuiolog
reading config info for /var/log/iscsiuio.log
reading config file salt
reading config info for /var/log/salt/master
reading config info for /var/log/salt/minion
reading config info for /var/log/salt/key
reading config info for /var/log/salt/cloud
reading config info for /var/log/salt/ssh
reading config file syslog
reading config info for /var/log/cron
/var/log/Toronto-Traps
/var/log/Toronto-Log
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler


reading config file yum
reading config info for /var/log/yum.log
reading config file zabbix-agent
reading config info for /var/log/zabbix/zabbix_agentd.log
reading config info for /var/log/wtmp
reading config info for /var/log/btmp

Handling 13 logs

rotating pattern: /var/log/ConsoleKit/history monthly (6 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/ConsoleKit/history
log does not need rotating

rotating pattern: /var/log/dracut.log 1048576 bytes (no old logs will be kept)
empty log files are not rotated, old logs are removed
considering log /var/log/dracut.log
log does not need rotating

rotating pattern: /var/log/iscsiuio.log weekly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/iscsiuio.log
log /var/log/iscsiuio.log does not exist -- skipping
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/salt/master weekly (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/master
log /var/log/salt/master does not exist -- skipping

rotating pattern: /var/log/salt/minion weekly (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/minion
log does not need rotating

rotating pattern: /var/log/salt/key weekly (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/key
log /var/log/salt/key does not exist -- skipping

rotating pattern: /var/log/salt/cloud weekly (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/cloud
log /var/log/salt/cloud does not exist -- skipping

rotating pattern: /var/log/salt/ssh weekly (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/ssh
log /var/log/salt/ssh does not exist -- skipping

rotating pattern: /var/log/cron
/var/log/Toronto-Traps
/var/log/Toronto-Log
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler

after 1 days (no old logs will be kept)
empty log files are rotated, old logs are removed
considering log /var/log/cron
error: stat of /var/log/cron failed: No such file or directory
considering log /var/log/Toronto-Traps
log does not need rotating
considering log /var/log/Toronto-Log
log does not need rotating
considering log /var/log/maillog
error: stat of /var/log/maillog failed: No such file or directory
considering log /var/log/messages
error: stat of /var/log/messages failed: No such file or directory
considering log /var/log/secure
error: stat of /var/log/secure failed: No such file or directory
considering log /var/log/spooler
log does not need rotating

rotating pattern: /var/log/yum.log yearly (no old logs will be kept)
empty log files are not rotated, old logs are removed
considering log /var/log/yum.log
log does not need rotating

rotating pattern: /var/log/zabbix/zabbix_agentd.log monthly (no old logs will be kept)
empty log files are not rotated, old logs are removed
considering log /var/log/zabbix/zabbix_agentd.log
log does not need rotating

rotating pattern: /var/log/wtmp monthly (1 rotations)
empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed
considering log /var/log/wtmp
log does not need rotating

rotating pattern: /var/log/btmp monthly (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/btmp
log does not need rotating



And logrotate -vf /etc/logrotate.conf
Quote:
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file ConsoleKit
reading config info for /var/log/ConsoleKit/history
reading config file dracut
reading config info for /var/log/dracut.log
reading config file iscsiuiolog
reading config info for /var/log/iscsiuio.log
reading config file salt
reading config info for /var/log/salt/master
reading config info for /var/log/salt/minion
reading config info for /var/log/salt/key
reading config info for /var/log/salt/cloud
reading config info for /var/log/salt/ssh
reading config file syslog
reading config info for /var/log/cron
/var/log/Toronto-Traps
/var/log/Toronto-Log
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler


reading config file yum
reading config info for /var/log/yum.log
reading config file zabbix-agent
reading config info for /var/log/zabbix/zabbix_agentd.log
reading config info for /var/log/wtmp
reading config info for /var/log/btmp

Handling 13 logs

rotating pattern: /var/log/ConsoleKit/history forced from command line (6 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/ConsoleKit/history
log does not need rotating

rotating pattern: /var/log/dracut.log forced from command line (no old logs will be kept)
empty log files are not rotated, old logs are removed
considering log /var/log/dracut.log
log does not need rotating

rotating pattern: /var/log/iscsiuio.log forced from command line (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/iscsiuio.log
log /var/log/iscsiuio.log does not exist -- skipping
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/salt/master forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/master
log /var/log/salt/master does not exist -- skipping

rotating pattern: /var/log/salt/minion forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/minion
log does not need rotating

rotating pattern: /var/log/salt/key forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/key
log /var/log/salt/key does not exist -- skipping

rotating pattern: /var/log/salt/cloud forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/cloud
log /var/log/salt/cloud does not exist -- skipping

rotating pattern: /var/log/salt/ssh forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/salt/ssh
log /var/log/salt/ssh does not exist -- skipping

rotating pattern: /var/log/cron
/var/log/Toronto-Traps
/var/log/Toronto-Log
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler

forced from command line (no old logs will be kept)
empty log files are rotated, old logs are removed
considering log /var/log/cron
error: stat of /var/log/cron failed: No such file or directory
considering log /var/log/Toronto-Traps
log needs rotating
considering log /var/log/Toronto-Log
log needs rotating
considering log /var/log/maillog
error: stat of /var/log/maillog failed: No such file or directory
considering log /var/log/messages
error: stat of /var/log/messages failed: No such file or directory
considering log /var/log/secure
error: stat of /var/log/secure failed: No such file or directory
considering log /var/log/spooler
log needs rotating
rotating log /var/log/Toronto-Traps, log->rotateCount is 0
dateext suffix '-20160808'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
rotating log /var/log/Toronto-Log, log->rotateCount is 0
dateext suffix '-20160808'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
rotating log /var/log/spooler, log->rotateCount is 0
dateext suffix '-20160808'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed

rotating pattern: /var/log/yum.log forced from command line (no old logs will be kept)
empty log files are not rotated, old logs are removed
considering log /var/log/yum.log
log needs rotating
rotating log /var/log/yum.log, log->rotateCount is 0
dateext suffix '-20160808'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
renaming /var/log/yum.log to /var/log/yum.log-20160808
disposeName will be /var/log/yum.log-20160808.gz
creating new /var/log/yum.log mode = 0600 uid = 0 gid = 0
compressing log with: /bin/gzip
removing old log /var/log/yum.log-20160808.gz

rotating pattern: /var/log/zabbix/zabbix_agentd.log forced from command line (no old logs will be kept)
empty log files are not rotated, old logs are removed
considering log /var/log/zabbix/zabbix_agentd.log
log does not need rotating

rotating pattern: /var/log/wtmp forced from command line (1 rotations)
empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed
considering log /var/log/wtmp
log needs rotating
rotating log /var/log/wtmp, log->rotateCount is 1
dateext suffix '-20160808'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
destination /var/log/wtmp-20160808.gz already exists, skipping rotation

rotating pattern: /var/log/btmp forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/btmp
log needs rotating
rotating log /var/log/btmp, log->rotateCount is 1
dateext suffix '-20160808'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
destination /var/log/btmp-20160808.gz already exists, skipping rotation



Whenever I ran manually, i dont see the log getting compressed/rotated. Could someone shed light on this please

Last edited by pradeepspa; 08-08-2016 at 08:18 AM.
 
Old 08-08-2016, 08:21 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,445
Blog Entries: 13

Rep: Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762
You can run logrotate with the -d flag for debug; however I believe that the "rotate 0" term in the main section near the comment "# keep 4 weeks worth of backlogs" is a potential problem where it will just delete the log files.
 
Old 08-08-2016, 08:49 AM   #3
pradeepspa
Member
 
Registered: Oct 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
I have already posted the debug output. Yeah, I dont want to keep any history and just want to delete it creating new log file.
 
Old 08-08-2016, 08:53 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
If
Code:
rotate 0
is dateext effective?
 
Old 08-08-2016, 08:55 AM   #5
pradeepspa
Member
 
Registered: Oct 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
By the way the log file im looking is "/var/log/Toronto-Log"
 
Old 08-08-2016, 09:02 AM   #6
pradeepspa
Member
 
Registered: Oct 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
Yes it is. But I dont know will it be usefull as old log will be deleted. when i do forceful rotate, i can see thi message coresponding to the log file in question.

Quote:
rotating log /var/log/Toronto-Log, log->rotateCount is 0
dateext suffix '-20160808'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
I am not sure what it means
 
  


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 is rotating all the rotations, how do I stop this? abefroman Linux - Software 10 11-10-2014 01:43 PM
[SOLVED] Logrotate rotating logs when they should not (I think!) yzT! Linux - Server 1 09-26-2014 10:51 AM
logrotate cron job not rotating certain logs ashokkvnit Linux - Software 4 04-02-2013 11:44 AM
logrotate cron job not rotating certain logs ashokkvnit Linux - Server 3 04-02-2013 09:32 AM
logrotate not rotating dman777 Linux - Software 3 08-23-2011 07:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration