On 2015-01-12 21:20, Andrei Borzenkov wrote:
В Mon, 12 Jan 2015 15:46:36 +0100 "Carlos E. R." <> пишет:
But it does not, apparently.
It does but see below.
└─4580 /usr/sbin/snmptrapd -A -LF n /var/log/net-snmpd.log -p /var/run/snmptrapd.pid
-LF n will limit output to messages of notice or higher priority and apparently snmptrapd logs incoming traps at info priority. Of course it is not documented anywhere.
The trick is in "/etc/sysconfig/net-snmp": ## Path: System/Net-SNMP ## Description: Log level of the snmp server. ## Type: string(!,a,c,e,w,n,i,d,0,1,2,3,4,5,6,7) ## Default: n # # Defines the log level for snmpd. # # The default is "n" (5, LOG_NOTICE) # SNMPD_LOGLEVEL="7" Change the default "n" to "7". It is probably the same as "d". The relevant section of the manual seems to be this: -L[efos] Specify where logging output should be directed (standard error or output, to a file or via syslog). See LOGGING OPTIONS in snmpcmd(1) for details. and LOGGING OPTIONS The mechanism and destination to use for logging of warning and error messages can be controlled by passing various parame- ters to the -L flag. -Le Log messages to the standard error stream. -Lf FILE Log messages to the specified file. -Lo Log messages to the standard output stream. -Ls FACILITY Log messages via syslog, using the specified facility ('d' for LOG_DAEMON, 'u' for LOG_USER, or '0'-'7' for LOG_LOCAL0 through LOG_LOCAL7). There are also "upper case" versions of each of these options, which allow the corresponding logging mechanism to be restricted to certain priorities of mes- sage. Using standard error logging as an example: -LE pri will log messages of priority 'pri' and above to standard error. -LE p1-p2 will log messages with priority between 'p1' and 'p2' (inclusive) to standard error. For -LF and -LS the priority specification comes before the file or facility token. The priorities recognised are: 0 or ! for LOG_EMERG, 1 or a for LOG_ALERT, 2 or c for LOG_CRIT, 3 or e for LOG_ERR, 4 or w for LOG_WARNING, 5 or n for LOG_NOTICE, 6 or i for LOG_INFO, and 7 or d for LOG_DEBUG. Normal output is (or will be!) logged at a priority level of LOG_NOTICE The default command line is: /usr/sbin/snmptrapd -A -LF n /var/log/net-snmpd.log \ -p /var/run/snmptrapd.pid The manual explains -Lf, but not -LF. From my tests, Lf seems to be a pipe, LF a file. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)