OK i am using Agentx Configuration

as a read somewhere in the forum that :

###################################################################
If your subagent understands the standard command-line arguments,
then you can use the -Lf option to specify the appropriate log file to use.

Otherwise, you could either code your subagent to use the
snmp_log_options() routine (to handle command-line options),
or extract the relevant code from this routine.

You basically need to set up a NETSNMP_LOGHANDLER_FILE
style log handler, and specify the name of the file to log to
(logh->token)
####################################################################

i tried using this as

logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);
        if (logh) 
        {
                logh->pri_max = pri_max;
                logh->token   = strdup("/root/myAgentx.log");
                netsnmp_enable_filelog(logh,
                                                           
netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
                                                                                
                          NETSNMP_DS_LIB_APPEND_LOGFILES));     
        }

but when i used API log file was created but logs for DEBUGMSG("Started") were 
found in the file

then i also added 
    debug_register_tokens("snmpV3Agent,currentAlarmTable");
    snmp_set_do_debugging(1);

Then the logs start coming but they were also shown on stdout(console) which i 
don,t won't so could it be possible that my subagent(Agentx) logs come in 
different file and master agent in different file


Thanks

----- Original Message -----
From: Magnus Fromreide <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: [email protected]
Sent: Fri, 13 Jun 2008 11:44:56 +0530 (IST)
Subject: Re: Logging of subagent to different file

On Tue, 2008-06-10 at 23:28 +0530, [EMAIL PROTECTED] wrote:
> Hello,
> 
> Could it be possible for creating a different log file for subagent
> and manage the log level and type of log messages to be logged.

Eh, it already is?

> What i understood was that all the logs are written
> to /var/log/snmpd.log , but is it right that 2 different process
> master agent and subagen write to this same file

Lets assume that you have the programs

snmpd (generated from ./configure ; make ; make install) and subagent
(generated from net-snmp-config --compile-subagent subagent subagent1.c
subagent2.c)

then

snmpd -Lf /tmp/my.snmpd.log.file

will send all logs from snmpd to /tmp/my.snmpd.log.file


and

subagent -Lf /tmp/my.subagent.log.file

will send all logs from subagent to /tmp/my.subagent.log.file.

/MF



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to