#2490 can't disable trap to syslog

traps
open
nobody
None
5
2013-09-23
2013-09-09
No

I can't disable logging of trap to syslog, with either snmptrapd -t or "donotlogtraps yes".

Thoses flags increase a variable SyslogTrap wich is used by syslog_handler.

But syslog_handler is never used. If I start snmptrapd with -Lsd -Dsnmptrapd, I can see in the logs :
2013-09-09 20:35:59] XXXX snmptrapd[16229]: print_handler

So even with syslog, print_handler is used.

In apps/snmptrapd.c, I see :

if (0 == snmp_get_do_logging()) {
...
} else {
    traph = netsnmp_add_global_traphandler(NETSNMPTRAPD_PRE_HANDLER,
                                           print_handler);
    traph->authtypes = TRAP_AUTH_LOG;
}

snmp_get_do_logging returns the value of logh_enabled. So if this value is set, syslog_handler will never be used.

So SyslogTrap should be checked in print_handler too.

Discussion

  • Wes Hardaker

    Wes Hardaker - 2013-09-23

    So, I can't actually reproduce this bug. You're using a few odd parameters though. IE, you're telling it to output to syslog using the -L switch and then don't output it using -t. So are you just hoping debugging output goes to syslog?

    Anyway, when I run it with a version from the master git branch, it logs to syslog only the packets it receives (ie, not the details of the trap and thus not the trap itself).

    What version are you using?

     
  • Fabrice Bacchella

    I did had the problem with a 5.7.2. But had a look at the head version from source forge.
    I want informational logging to go to syslog but not every trap received, because they goes to snmptt. I thought that "donotlogtraps yes" would do that.

    I wrote a patch that solved my problem, it's joined.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks