Discussion:
Regarding logOption in snmptrapd.conf file
(too old to reply)
Adishesh M
2013-01-02 07:37:09 UTC
Permalink
Hi,

I am using below line in snmptrapd.conf file to log all traps received
into a file.

logOption f /tmp/all_traps


and I am running snmptrapd with below option
/usr/sbin/snmptrapd -Ot -On –OQ



I want all the traps received to be logged to into my file only and
not to syslog (/var/log/messages) . Even with above option snmptrapd
is logging the traps received to both the places: syslog and my log
file.

How to avoid logging of traps in syslog.

Thanks and regards,
Adishesh
Dave Shield
2013-01-05 10:41:24 UTC
Permalink
Post by Adishesh M
I want all the traps received to be logged to into my file only and
not to syslog (/var/log/messages)
How to avoid logging of traps in syslog.
I've done some quick testing, and the best way to achieve this seems
to be to specify the option -Lf /tmp/all_traps on the command line.

Depending on the version of the code (and you haven't specified this),
trying to set this in the trapd config file is either not processed
early enough,
or needs to be marked with '[snmp]' (and still doesn't seem to work properly)

Include the logging options on the command line settings - that should work OK

Dave
Dave Shield
2013-01-07 08:50:16 UTC
Permalink
[ First - *please* don't mail me privately, without copying
any responses to the mailing list. I don't have the time
or inclination to offer private, unpaid, SNMP consultancy.
Keep discussions to the list, where others can both learn
and offer advice. Thanks. ]
Hi Dave,
I am using below net-snmp version.
net-snmp-utils-5.5-41.el6.x86_64
net-snmp-libs-5.5-41.el6.x86_64
net-snmp-libs-5.5-41.el6.i686
net-snmp-5.5-41.el6.x86_64
net-snmp-perl-5.5-41.el6.x86_64
command line option -Lf /tmp/all_traps is working.
is there any way to do it in snmptrapd.conf file.
Probably not - no.

The 5.5 line still processes the logOptions token
at a relatively late stage - i.e. after the logging has
already been activated.
i dont want to
change the /etc/init.d/snmptrapd file which i am using for starting
snmptrapd service.
Given your setup and requirements, I'm not sure you have a choice.

Either you upgrade to a new version of the software
(which is meant to have fixed the problem, though I'm not entirely convinced)
or you install a version compiled from source
(with a suitable tweak to the code)
or you configure this behavious via the service startup file
or you accept that the trap receiver will log via syslog as well as to
the specified logfile.

Your choice.

Dave
Adishesh M
2013-01-08 08:16:18 UTC
Permalink
Hi Dave,

Using latest version NET-SNMP Version: 5.7.2 same other error is coming.


snmptrapd is not recognizing logOption
Jan 8 13:35:17 mercury13 snmptrapd[8863]: /etc/snmp/snmptrapd.conf:
line 36: Warning: Unknown token: logOption.

it is still logging traps to /var/log/messages file.

my snmptrapd.conf file content is as given below and i am calling
snmptrapd using command '/usr/local/sbin/snmptrapd -C -c
/etc/snmp/snmptrapd.conf -Ot -On -OQ'
snmpTrapdAddr UDP:162
pidFile /var/run/snmptrapd.pid
logOption -f /tmp/all_traps
authCommunity log public

Thanks and regards,
Adishesh
Post by Dave Shield
[ First - *please* don't mail me privately, without copying
any responses to the mailing list. I don't have the time
or inclination to offer private, unpaid, SNMP consultancy.
Keep discussions to the list, where others can both learn
and offer advice. Thanks. ]
Hi Dave,
I am using below net-snmp version.
net-snmp-utils-5.5-41.el6.x86_64
net-snmp-libs-5.5-41.el6.x86_64
net-snmp-libs-5.5-41.el6.i686
net-snmp-5.5-41.el6.x86_64
net-snmp-perl-5.5-41.el6.x86_64
command line option -Lf /tmp/all_traps is working.
is there any way to do it in snmptrapd.conf file.
Probably not - no.
The 5.5 line still processes the logOptions token
at a relatively late stage - i.e. after the logging has
already been activated.
i dont want to
change the /etc/init.d/snmptrapd file which i am using for starting
snmptrapd service.
Given your setup and requirements, I'm not sure you have a choice.
Either you upgrade to a new version of the software
(which is meant to have fixed the problem, though I'm not entirely convinced)
or you install a version compiled from source
(with a suitable tweak to the code)
or you configure this behavious via the service startup file
or you accept that the trap receiver will log via syslog as well as to
the specified logfile.
Your choice.
Dave
Dave Shield
2013-01-08 08:23:46 UTC
Permalink
Post by Adishesh M
Using latest version NET-SNMP Version: 5.7.2 same other error is coming.
snmptrapd is not recognizing logOption
Please see my earlier message:


trying to set this {logOption} in the trapd config file is either not
processed early enough,
=***=> or needs to be marked with '[snmp]' <=***=
(and still doesn't seem to work properly)
Post by Adishesh M
my snmptrapd.conf file content is as given below and i am calling
snmpTrapdAddr UDP:162
pidFile /var/run/snmptrapd.pid
logOption -f /tmp/all_traps
This line needs to be given as

[snmp] logOption -f /tmp/all_traps


Recent changes have moved logOption from being an
application-level directive to a library one,
which means that it needs to be marked as such when
appearing in the application-specific config file.


But as I said above, I'm still not convinced that this is
working correctly.

Dave
m***@gmail.com
2013-11-13 14:34:57 UTC
Permalink
[snmp] logOption -f /tmp/all_traps

Solved the issue for me, thanks.

Really could not have guessed this from the man pages though.

Thanks,
Mooli.
Post by Dave Shield
Post by Adishesh M
Using latest version NET-SNMP Version: 5.7.2 same other error is coming.
snmptrapd is not recognizing logOption
trying to set this {logOption} in the trapd config file is either not
processed early enough,
=***=> or needs to be marked with '[snmp]' <=***=
(and still doesn't seem to work properly)
Post by Adishesh M
my snmptrapd.conf file content is as given below and i am calling
snmpTrapdAddr UDP:162
pidFile /var/run/snmptrapd.pid
logOption -f /tmp/all_traps
This line needs to be given as
[snmp] logOption -f /tmp/all_traps
Recent changes have moved logOption from being an
application-level directive to a library one,
which means that it needs to be marked as such when
appearing in the application-specific config file.
But as I said above, I'm still not convinced that this is
working correctly.
Dave
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Net-snmp-users mailing list
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
r***@gmail.com
2015-05-07 20:20:32 UTC
Permalink
Post by Dave Shield
[snmp] logOption -f /tmp/all_traps
Solved the issue for me, thanks.
Really could not have guessed this from the man pages though.
Thanks,
Mooli.
Post by Dave Shield
Post by Adishesh M
Using latest version NET-SNMP Version: 5.7.2 same other error is coming.
snmptrapd is not recognizing logOption
trying to set this {logOption} in the trapd config file is either not
processed early enough,
=***=> or needs to be marked with '[snmp]' <=***=
(and still doesn't seem to work properly)
Post by Adishesh M
my snmptrapd.conf file content is as given below and i am calling
snmpTrapdAddr UDP:162
pidFile /var/run/snmptrapd.pid
logOption -f /tmp/all_traps
This line needs to be given as
[snmp] logOption -f /tmp/all_traps
Recent changes have moved logOption from being an
application-level directive to a library one,
which means that it needs to be marked as such when
appearing in the application-specific config file.
But as I said above, I'm still not convinced that this is
working correctly.
Dave
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Net-snmp-users mailing list
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Hey ,

Can you send me your snmptrapd.conf file which use to capture logs in log file when snmp traps receives on the interface?

I am able to see traps when i run " snmptrapd -f -C -c snmptrapd.conf -Le "

Do we need run any specific command after reconfiguring .conf file?

what configuration i need to do so that whenever traps coming on interface they will log in to the file ?

I will really appreciate if you could answer to my question.

Loading...