Hi 

I ran the snmptrapd command  as "snmptrapd -f -d -Dsnmptrapd  -Lf 
mytest.log -c  $home/snmptrapd.conf ". And from another machine i sent 
trap messages to this machine. As a result i got trap messages ,but  it 
failed to loginto file "mytest.log" . I got "could not format log string" 
error on stderr. 

My trap messages have 14  varbinds and  total size of this trap message is 
less then 1024. If i send 11 varbinds in my trap messages then i can able 
to see it in mytest.log file. I tried with different combination of 10 
varbinds and for all that test  i observed trap message in log file(i.e no 
issue with varbinds). Then i walk through function snmp_vlog() function of 
snmp_logging.c 

int
snmp_vlog(int priority, const char *format, va_list ap)
{
    char            buffer[LOGLENGTH];
    int             length;
    char           *dynamic;
    va_list         aq;

    va_copy(aq, ap);
    length = vsnprintf(buffer, LOGLENGTH, format, ap);
    va_end(ap);

    if (length == 0) {
#ifdef NEED_VA_END_AFTER_VA_COPY
        va_end(aq);
#endif
        return (0);             /* Empty string */
    }

    if (length == -1) {
        snmp_log_string(LOG_ERR, "Could not format log-string\n");
#ifdef NEED_VA_END_AFTER_VA_COPY



I observed that its because of  vsnprintf call return -1, i suspect that 
some how output was truncated and hence i got "could not format log" 
string error(-1) .
I walking through the snmptrapd.c code to get to know where exactly 
snmp_log() function is calling  and what  value it is passing to "format" 
variable. 

Could you please let me know what exactly the problem and how to overcome 
from this situation.


2) Is there any way  i can redirect stderr to  file in "traphandler" 
directive  like below.

 traphandle MIB:OID my-script.pl arg 2>err_log

3) The option " -LF priority "  in snmptrapd is specific to net-snmp 
errors ? or is this option applies to the errors from  the script 
specified in "traphandler".


 

<<image/gif>>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to