syslog.conf question: log into a separate file, but not into /var/log/messages

2006-11-24 Thread Alexander Farber

Hi,

I've read man syslog.conf several times, especially this passage:

!!prog causes the subsequent block to abort evaluation when a message
matches, ensuring that only a single set of actions is taken.  !* can be
used to ensure that any ensuing blocks are further evaluated (i.e. can-
celling the effect of a !prog or !!prog).

but don't understand it and how to adapt it for my purpose:

I have a program called pref which does following:

   openlog(__progname, LOG_CONS | LOG_PID, LOG_DAEMON);
...
   syslog(LOG_INFO, %s, msg);
...
   syslog(LOG_WARNING, %s, msg);
...
   syslog(LOG_ERR, %s, msg);

I'd like all of those messages to go into separate file /var/log/pref
but not into the /var/log/messages. So first I've appended

   !pref
   *.*/var/log/pref

to the /etc/syslog.conf, touched the /var/log/pref, adapted
newsyslog.conf and pkill -HUPped syslogd. This worked,
but the messages also were written into /var/log/messages.

Then I've added a second ! and moved those 2 lines to
the top of /etc/syslog.conf:

   !!pref
   *.*/var/log/pref

Now no messages at all are written into /var/log/messages :-/

Can anyone please give me a hint?

Regards
Alex




--
http://preferans.de



Re: syslog.conf question: log into a separate file, but not into /var/log/messages

2006-11-24 Thread Stuart Henderson
On 2006/11/24 10:50, Alexander Farber wrote:
 I've read man syslog.conf several times, especially this passage:
...
 but don't understand it and how to adapt it for my purpose:

see the 'examples' section where this is demonstrated.



Re: syslog.conf question: log into a separate file, but not into /var/log/messages

2006-11-24 Thread Marcus Popp
Hi Alexander,

On 2006-11-24T10:50, Alexander Farber wrote:
 Then I've added a second ! and moved those 2 lines to
 the top of /etc/syslog.conf:
 
!!pref
*.*/var/log/pref
 
 Now no messages at all are written into /var/log/messages :-/
 
 Can anyone please give me a hint?

read man syslog.conf

!!prog causes the subsequent block to abort evaluation when a message
matches, ensuring that only a single set of actions is taken.  !* can be
used to ensure that any ensuing blocks are further evaluated (i.e. can-
celling the effect of a !prog or !!prog).

hth,

Marcus.



Re: syslog.conf question: log into a separate file, but not into /var/log/messages

2006-11-24 Thread Otto Moerbeek
On Fri, 24 Nov 2006, Alexander Farber wrote:

 Hi,
 
 I've read man syslog.conf several times, especially this passage:
 
 !!prog causes the subsequent block to abort evaluation when a message
 matches, ensuring that only a single set of actions is taken.  !* can be
 used to ensure that any ensuing blocks are further evaluated (i.e. can-
 celling the effect of a !prog or !!prog).
 
 but don't understand it and how to adapt it for my purpose:
 
 I have a program called pref which does following:
 
openlog(__progname, LOG_CONS | LOG_PID, LOG_DAEMON);
 ...
syslog(LOG_INFO, %s, msg);
 ...
syslog(LOG_WARNING, %s, msg);
 ...
syslog(LOG_ERR, %s, msg);
 
 I'd like all of those messages to go into separate file /var/log/pref
 but not into the /var/log/messages. So first I've appended
 
!pref
*.*/var/log/pref
 
 to the /etc/syslog.conf, touched the /var/log/pref, adapted
 newsyslog.conf and pkill -HUPped syslogd. This worked,
 but the messages also were written into /var/log/messages.
 
 Then I've added a second ! and moved those 2 lines to
 the top of /etc/syslog.conf:
 
!!pref
*.*/var/log/pref
 
 Now no messages at all are written into /var/log/messages :-/
 

Add the end marker !* after the *.* line

-Otto



Re: syslog.conf question: log into a separate file, but not into /var/log/messages

2006-11-24 Thread Alexander Farber

Hi Marcus,

On 11/24/06, Marcus Popp [EMAIL PROTECTED] wrote:

 Can anyone please give me a hint?

read man syslog.conf


read my original mail.

Can you imagine, that I've read the man page,
but it is just not good enough for me (or vice versa)?

Regards
Alex

--
http://preferans.de



Re: syslog.conf question: log into a separate file, but not into /var/log/messages

2006-11-24 Thread Alexander Farber

Thanks Otto, that was it

On 11/24/06, Otto Moerbeek [EMAIL PROTECTED] wrote:

!!pref
*.*/var/log/pref

 Now no messages at all are written into /var/log/messages :-/


Add the end marker !* after the *.* line

-Otto




Re: syslog.conf question: log into a separate file, but not into /var/log/messages

2006-11-24 Thread Robert Urban

Alexander Farber wrote:

I've read man syslog.conf several times, especially this passage:

!!prog causes the subsequent block to abort evaluation when a message
matches, ensuring that only a single set of actions is taken.  !* 
can be
used to ensure that any ensuing blocks are further evaluated (i.e. 
can-

celling the effect of a !prog or !!prog).

you might consider simply replacing syslog with syslog-ng.

Rob Urban