Sponsored Content
Top Forums UNIX for Dummies Questions & Answers logrotate ignore 'rotate' setting. Post 302503926 by frankkoenen on Saturday 12th of March 2011 03:13:29 PM
Old 03-12-2011
These settings have been in place for more than 6 months.

I considered the same situation the the size setting was an issue, and setup a test.

I created an entry called /etc/logrotate.d/testfrank to process a rotation on file /tmp/local0notices but with the same size and rotate settings otherwise:


Quote:
/tmp/local0notices {
missingok
daily
rotate 12
size 50M
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
and then I ran this short script, which creates 20 60M files in /tmp of the same name 'local0notices' and runs logrotate on them ...

Code:
for x in 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 ; do
  dd if=/dev/zero of=/tmp/local0notices bs=1024 count=60000
  ls -lh /tmp/local0notices
  /usr/sbin/logrotate -v /etc/logrotate.conf 
  ls -altr /tmp/local0notices*
done

the result of which is good, I see 12 files in /tmp ...

Quote:
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.12.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.11.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.10.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.9.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.8.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.7.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.6.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.5.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.4.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.3.gz
-rw-r----- 1 root adm 59657 Mar 12 13:03 /tmp/local0notices.2.gz
-rw-r----- 1 root adm 61440000 Mar 12 13:03 /tmp/local0notices.1
-rw-r----- 1 root adm 0 Mar 12 13:03 /tmp/local0notices
The test works fine.

What looks weird to me on the real files, besides there's only ever 4 versions when I am trying to maintain 12, is the size of the files. It looks suspicious like another configuration setting may be processing the files before they're reaching 50M, the 433045 should be 50M or more.
I'm also not sure about the file name ending with .0 My test script didn't create a .0 file? ...:

Quote:
# ls -la /var/log/local0notices* | cat -n
1 -rw-r----- 1 syslog adm 342596 Mar 12 12:43 /var/log/local0notices
2 -rw-r----- 1 syslog adm 433045 Mar 6 21:16 /var/log/local0notices.0
3 -rw-r----- 1 syslog adm 51107 Feb 27 20:54 /var/log/local0notices.1.gz
4 -rw-r----- 1 syslog adm 42670 Feb 20 21:07 /var/log/local0notices.2.gz
5 -rw-r----- 1 syslog adm 35328 Feb 13 21:18 /var/log/local0notices.3.gz
6 -rw-r----- 1 syslog adm 331 Feb 18 2010 /var/log/local0notices.4.gz
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

log rotate

hi , what is the meaning of log rotate? how do i rotate /var/adm/wtmps log and gzip it? (6 Replies)
Discussion started by: cromohawk
6 Replies

2. Ubuntu

logrotate - why ignore size ?

Hi, i have a logroate script that works properly when running manually but otherwise it won't work.I put in in /etc/logrotate.d/nginx. I simply cannot understand why it won't run properly when run with a cronjob. It suppose to run hourly and rotate logs if they are > 3mb. What am i missing here ?:... (1 Reply)
Discussion started by: ktm
1 Replies

3. UNIX for Advanced & Expert Users

logrotate with /etc/logrotate.conf file

Hi there, I want to rotate the logfiles which are located in /var/log/jboss/tomcat* so I have created a file named as 'tomat' in /etc/logrotate.d/tomcat with the following content. # cat /etc/logrotate.d/tomcat /var/log/jboss/tomcat_access_log*.log { daily nocreate ... (2 Replies)
Discussion started by: skmdu
2 Replies

4. UNIX for Advanced & Expert Users

rotate modsec log with logrotate in the global configuration

Hello Experts, I have an apache 2.2.17 on solaris 10 that I am not sure if I, could list the following in the global settings in httpd.conf. I tested it in the Virtual host section of httpd.conf and, it works but, not sure if I can do it in the global settings. Any help would be greatly... (0 Replies)
Discussion started by: afadaghi
0 Replies

5. Programming

setting netbeans to ignore from expired ssl certificate

Hi, I am not sure this is the correct section. My question is not directly about programming about developing IDE. I am using netbeans to develop my project. I created a new project from a remote server. I have set all the details. One problem is that the server ssl has already expired... (0 Replies)
Discussion started by: programAngel
0 Replies

6. Shell Programming and Scripting

Logrotate - I am not able to rotate files using logrotate

I have written script which is working in Home directory perfectly and also compressing log files and rotating correctly. But, when i try to run script for /var/log/ i am able to get compressed log files but not able to get rotation of compressed log files. Please suggest. I am using below command... (5 Replies)
Discussion started by: VSom007
5 Replies

7. AIX

Logrotate - /etc/logrotate.conf does't exist

Hi Admins. I have installed logrotate rpm on Aix 6.1. After the installation of rpm, I don't find /etc/logrotate.conf file and /etc/logrotate.d dir . The config file is located in /opt/freeware/etc/logrotate.conf. When I ran logrotate -v /opt/freeware/etc/logrotate.conf I get below... (2 Replies)
Discussion started by: snchaudhari2
2 Replies

8. HP-UX

How To Rotate A File in HP-UX?

I need to rotate a file in HP-UX of a application. I´ve tried to do a task in the cron with a script (with sed and ed commands) but it was a successfully option (the application continued writing the file :( ) LINEAS_OUT=$(wc -l < $RMISTDOUT) LINEAS_FIN=1,expr $LINEAS_OUT - 100p sed... (19 Replies)
Discussion started by: werkraft
19 Replies

9. Shell Programming and Scripting

Log rotate

Hi, I have below script in logrotate.d to rotate logs. logs are not rotating after the file grow to 1k, do you have any idea? Is it because of it just only 1K? Please let me know if the below syntax is in correct. # more trotate /sourcepath/*/servers/*/logs/*log... (2 Replies)
Discussion started by: lpprasad321
2 Replies

10. UNIX for Dummies Questions & Answers

Logs do not rotate

My problem: Both access and error logs do not rotate any more and get really large. They are located here: /srv/www/+vHost name here+/logs/ Configuration seems to be here: /etc/logrotate.conf => looks OK, including "size 10M" to avoid large files (/etc/logrotate.d => is empty) manually... (4 Replies)
Discussion started by: floko
4 Replies
strclean(8)						      System Manager's Manual						       strclean(8)

NAME
strclean - Removes outdated STREAMS error log files SYNOPSIS
/usr/sbin/strclean [-d logdir] [-a age] FLAGS
Specifies a maximum age in days for the STREAMS error log files if this not the default age of 3. The value of age must be an integer greater than or less than 3. Specifies a directory for the location of the STREAMS error log files to be removed if this is not the default directory /var/adm/streams. DESCRIPTION
The strclean command cleans the STREAMS error logger directory of log files (error.mm-dd) that contain error messages sent by the STREAMS log driver (strlog). If no other directory is specified (the logdir argument), the command removes error log files in the /var/adm/streams directory. If no other age is specified (the age argument), the command removes error log files that have not been modified in 3 days. The strclean command is executed by the cron daemon on a periodic basis. EXAMPLES
To remove the day-old error log files from a directory called /tmp/streams, enter: strclean -d /tmp/streams -a 1 FILES
One or more error log file or files on which strclean operates. The mm.dd in the filename indicates the month and day of the messages con- tained in the file. RELATED INFORMATION
Commands: strerr(8), cron(8). Interfaces: strlog(7). delim off strclean(8)
All times are GMT -4. The time now is 01:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy