Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logrotate not working for me

Status
Not open for further replies.

edpatterson

IS-IT--Management
Feb 24, 2005
186
0
0
Ubuntu Server 8.10

I am trying to get the log files from the 2nd instance of squid to rotate. More on that later. When it failed I decided to test my config files so I did the following, as root.

Created a log file
ls /bin > /tmp/log/bin.log

Created a config file, rotate
[tt]/tmp/log/*,log {
rotate 2
create 666 root root
missingok
sharedscripts
}[/tt]

Forced the logs to rotate from within the same directory as the log and config file
[tt]logrotate -d -f rotate [/tt]

The following is shown on the console
[tt]
reading config file rotate
reading config info for /tmp/log/*.log

Handling 1 logs

rotating pattern: /tmp/log/*.log forced from command line (2 rotations)
empty log files are rotated, old logs are removed
considering log /tmp/log/bin.log
log needs rotating
rotating log /tmp/log/bin.log, log->rotateCount is 2
renaming /tmp/log/bin.log.2 to /tmp/log/bin.log.3 (rotatecount 2, logstart 1, i 2),
renaming /tmp/log/bin.log.1 to /tmp/log/bin.log.2 (rotatecount 2, logstart 1, i 1),
renaming /tmp/log/bin.log.0 to /tmp/log/bin.log.1 (rotatecount 2, logstart 1, i 0),
renaming /tmp/log/bin.log to /tmp/log/bin.log.1
creating new log mode = 0666 uid = 0 gid = 0
removing old log /tmp/log/bin.log.3
[/tt]

Only the original 2 files are in the /tmp/log directory. I am beyond baffled.
Ed
 
in some versions of linux, contents of tmp folder get purged out after a certain amount of time.
maybe that is happening here.
 
Thanks, someone on the UbuntuFourms hit it right on the head. The -d switch was putting it into debug mode so no changes were actually being made.

The really sad part is I had actually printed out the man pages and highlighted the verbiage of all the switches I was using. I guess I read one thing but understood another.

Thanks for the reply! I was not aware that items in /tmp/ might get purged!

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top