- logrotate won't rotate logfile on the first run
- Posted by Skip Montanaro on December 1st, 2003
I installed logrotate on a Solaris 8 system today to manage
rotation of some fast-growing firewall files. Using this definition:
/var/adm/netscreen.log {
daily
rotate 30
missingok
compress
postrotate
/usr/bin/pkill -HUP syslogd
endscript
}
when I ran logrotate for the first time manually, it said:
reading config file /usr/local/etc/logrotate.conf
including /usr/local/etc/logrotate.d
reading config file syslog
reading config info for /var/adm/netscreen.log
Handling 1 logs
rotating pattern: /var/adm/netscreen.log after 1 days (30 rotations)
empty log files are rotated, old logs are removed
considering log /var/adm/netscreen.log
log does not need rotating
I understand that with the -d flag nothing is actually done. Even
specifying the -v flag (without -d) after zapping the status file
it says "log does not need rotating". Am I missing something?
I would have thought it would rotate the log on the first run.
It did create /var/log/logrotate.status with these contents:
logrotate state -- version 2
"/var/adm/netscreen.log" 2003-12-1
I have a cron job set to run logrotate at 4:20am, but I suspect it won't
do anything. Any hints?
Thx,
Skip Montanaro
skip@pobox.com
- Posted by P.T. Breuer on December 1st, 2003
Skip Montanaro <skip@pobox.com> wrote:
Shrug. Edit logrotate.status and set the date inside it back one day.
Then repeat your experiment.
Peter
- Posted by Skip Montanaro on December 2nd, 2003
ptb@oboe.it.uc3m.es (P.T. Breuer) wrote in message news:<u56gqb.f9u.ln@news.it.uc3m.es>...
Thanks, that did the trick. The second experiment was a success.
Skip
- Posted by Bill Marcum on December 2nd, 2003
On 1 Dec 2003 10:23:40 -0800, Skip Montanaro
<skip@pobox.com> wrote:
(b) Create a fake status file with yesterday's date.
--
Thanks to Nigeria, any email with the word "urgent" in the subject
or address will be deleted.
- Posted by Bill Unruh on December 3rd, 2003
Bill Marcum <bmarcum@iglou.com.urgent> writes:
]On 1 Dec 2003 10:23:40 -0800, Skip Montanaro
] <skip@pobox.com> wrote:
]>
]> I have a cron job set to run logrotate at 4:20am, but I suspect it won't
]> do anything. Any hints?
]>
](a) Wait and see.
](b) Create a fake status file with yesterday's date.
Or just run logrotate. The cron job just runs it. You can run it.
/etc/cron.daily/logrotate