Forum Moderators: coopster

Message Too Old, No Replies

syslog

         

mitchell 1078

3:00 pm on Mar 18, 2005 (gmt 0)

10+ Year Member



Dear all,

I am trying to keep local0.info in my log. But other processes using local0.notice are keeping its entries in my log too. Could anybody give me an idea to fix it? ( my OS is solaris )

Here is my syslog function.

function logger($uname)
{
define_syslog_variables();
openlog("MailRCPT",LOG_PID ¦ LOG_PERROR, LOG_LOCAL0);
syslog(LOG_INFO, " $_SERVER[REMOTE_ADDR] $uname");
closelog();
}

In syslog.conf, I wrote this.

local0.info /my/dir/log/mylog.log

jatar_k

9:52 pm on Mar 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld mitchell 1078,

I see some issues

logs are done by levels and info is the absolute lowest aside from debug so that would also include

EMERG, ALERT, CRIT, ERR, WARNING, NOTICE and of course INFO

this is a situation specific to Solaris, other systems would have just info messages going to a LOCAL0.info

you are also using the option LOG_PERROR so this will also copy to standard error which is usually located in /var/adm/messages. I don't know if that is your intention or not, just mentioning it.

I am also wondering why it seems you are logging mail, not that it matters, just struck me. mail logs might work as well.

I would suggest playing with the levels or just using a different LOCAL for these particular messages.

mitchell 1078

6:09 am on Mar 19, 2005 (gmt 0)

10+ Year Member



Hi

Thank you so much for your reply. LOG_PERROR is unintentionally used here and I drop this. I am just trying to keep log entries for every user who access my system. ( not mail log, just for administrative purporse ) To avoid other processes' log entries, how can I implement different LOCAL? Could you please give me some hints?

regards,
Mitchell

jatar_k

4:31 pm on Mar 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it would be as simple as

function logger($uname)
{
define_syslog_variables();
openlog("MailRCPT",LOG_PID, LOG_LOCAL1);
syslog(LOG_INFO, " $_SERVER[REMOTE_ADDR] $uname");
closelog();
}