1

I don't know if this is the right place to ask this question, but, does anyone knows about Net-SNMP. Is it possible to not truncate the log file whenever snmptrapd is restarted?

The logs are being rotated by logrotate. But whenever I restart the snmp listener using this command:

/etc/init.d/snmptrapd restart

Or using this:

/etc/init.d/snmptrapd start

The log file for snmptrapd is being restarted to 0KB (restarted), previous logs are being deleted. We don't want that to happen.

  • What exact operating system, what exact versions? Why do you want to discard old logs uncondicionally, and not e.g. rotate them? – vonbrand Mar 3 '14 at 4:25
  • OS is linux. Actually, we really don't like to discard old logs thus the question on how we can modified the default behavior of the Net-SNMP listener truncating its log file whenever it is restarted. The goal is to append log files even the snmp listener is restarted. – user60216 Mar 3 '14 at 5:40
0

Use -A option:

Append to the log file rather than truncating it. Note that this needs to come before any -Lf options that it should apply to.

(via http://www.net-snmp.org/docs/man/snmptrapd.html)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.