Bug 125004 - snmpd still logs to old file after logrotate runs
snmpd still logs to old file after logrotate runs
Product: Fedora
Classification: Fedora
Component: net-snmp (Show other bugs)
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Radek Vokal
Depends On:
Blocks: FC3Target
  Show dependency treegraph
Reported: 2004-06-01 18:26 EDT by Teraya
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-15 05:17:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Teraya 2004-06-01 18:26:22 EDT
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 {
        /sbin/service snmpd condrestart 2> /dev/null > /dev/null || true


Version-Release number of selected component (if applicable):

How reproducible:

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 18:42:20 EDT
Created attachment 100771 [details]
Fixed /etc/logrotate.d/snmpd
Comment 2 Radek Vokal 2004-10-15 05:17:19 EDT
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.