Bug 125004 - snmpd still logs to old file after logrotate runs
Summary: snmpd still logs to old file after logrotate runs
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: net-snmp
Version: 2
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Radek Vokal
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: FC3Target
TreeView+ depends on / blocked
 
Reported: 2004-06-01 22:26 UTC by Teraya
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-15 09:17:19 UTC


Attachments (Terms of Use)
Fixed /etc/logrotate.d/snmpd (154 bytes, text/plain)
2004-06-01 22:42 UTC, Teraya
no flags Details

Description Teraya 2004-06-01 22:26:22 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
I've noticed this on different Red Hat & Fedora versions.  
It seems snmpd would need to be restarted in order to prevent it from
logging to an archived log file after logrotate runs.  

The following is what I have done on my servers to remedy the
situation.  This will restart snmpd if it is running at the time,
causing it to begin logging to a "new" snmpd.log file.  

--------
Modify /etc/logrotate.d/snmpd to appear as...  
(Note, this is adding three lines, "postrotate" thru "endscript")

/var/log/snmpd.log {
    notifempty
    missingok
    postrotate
        /sbin/service snmpd condrestart 2> /dev/null > /dev/null || true
    endscript
}

--------


Version-Release number of selected component (if applicable):
net-snmp-5.1.1-2

How reproducible:
Always

Steps to Reproduce:
1. Install & enable snmpd
2. Query your machine via snmp
3. Allow logrotate to rotate snmpd logs as usual
4. Query your machine again via snmp
5. Look at log files (/var/log/snmpd.log*)


Actual Results:  Originally logs to /var/log/snmpd.log.  
After log rotation, continues to log to the same inode, which has
become a different filename (/var/log/snmpd.log.1).  

Expected Results:  Logging should have gone to the new "snmpd.log"
file after rotation.  

Additional info:

-rw-r--r--    1 root     root          169 Jun  1 18:00 snmpd.log.1
-rw-r--r--    1 root     root            0 May 22 00:03 snmpd.log

(Log rotation moved original snmpd.log to snmpd.log.1, then created a
new snmpd.log...  meanwhile snmpd continues to write to the
snmpd.log.1 file, because it kept the same inode/filehandle when it
was moved).

Comment 1 Teraya 2004-06-01 22:42:20 UTC
Created attachment 100771 [details]
Fixed /etc/logrotate.d/snmpd

Comment 2 Radek Vokal 2004-10-15 09:17:19 UTC
fixed in net-snmp-5.1.2-11


Note You need to log in before you can comment on or make changes to this bug.