Project

General

Profile

Bug #4428

logadm ignoring -p flag

Added by Robert Mustacchi over 5 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
2013-12-24
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

It appears that logadm does not respect the -p flag when configuring log rotation in /etc/logadm.conf. Here's the line I have in /etc/logadm.conf.

nginx -A 1y -N -a '/usr/sbin/svcadm refresh nginx' -p 2h -t '$dirname/rotated/$basename-%Y%m%d-%H%M%S' -z 1 /var/log/nginx/*.log

It is clear that the logs are not being rotated every 2 hours, but are being rotated at the interval that is in the cron job of the machine, which is:

10 * * * * /usr/sbin/logadm

Sure enough, my directory listing shows a rotated log file at 10 past every hour.

[root@fd08e374-9133-6a83-aee3-cc00c000cdfd ~]# ls -alh /var/log/nginx/rotated/ | tail
-rw-r--r-- 1 root root   46 Nov  6 05:10 error.log-20131106-061000.gz
-rw-r--r-- 1 root root   46 Nov  6 06:10 error.log-20131106-071000.gz
-rw-r--r-- 1 root root   46 Nov  6 07:10 error.log-20131106-081000.gz
-rw-r--r-- 1 root root   46 Nov  6 08:10 error.log-20131106-091000.gz
-rw-r--r-- 1 root root   46 Nov  6 09:10 error.log-20131106-101000.gz
-rw-r--r-- 1 root root   46 Nov  6 10:10 error.log-20131106-111000.gz
-rw-r--r-- 1 root root   46 Nov  6 11:10 error.log-20131106-121000.gz
-rw-r--r-- 1 root root   46 Nov  6 12:10 error.log-20131106-131000.gz
-rw-r--r-- 1 root root   46 Nov  6 13:10 error.log-20131106-141000.gz
-rw-r--r-- 1 root root    0 Nov  6 14:10 error.log-20131106-151000

Jerry's analysis was:

This occurs when the log name is different from the log file name. For example, in this case the log name is "nginx" but there are two different log file names that this entry applies to (due to the wildcards). In this case we were not matching up with the correct entry in the timestamp file. Since we never got the correct -P timestamp, we always fell through and rotated the log every time logadm ran.

History

#1

Updated by Robert Mustacchi over 5 years ago

  • Status changed from New to Resolved

Resolved in 34969e746608c8170ab540c876836f625f25d8eb.

Also available in: Atom PDF