Search code examples
c++macosloggingsyslogasl

apple logger (ASL) ignoring rule in /etc/asl.conf for specific facility


I've got a C/C++/Objective-C project that send asl logging messages.

The default configuration in asl.conf route all log message with level above notice to system log (see below rule), and I'd like to cancel this rule for my specific facility only.

This means, that all log messages under my facility will be routed to my log file only, and not to system.log.

here's the configuraiton where my facility is defined to com.bla.bla asl.conf ? [<= Level notice] file system.log

my_asl.conf
? [<= Level notice] [=Facility com.bla.bla] skip / ignore 

I've tried both skip and ignore, but i didn't made any change. the only thing that work is to erase the rule from asl.conf, but i don't want to change the behavior of other processes / facilities and to modify some default rules.

is there any rule i can add to ban my messages only from system.log ?

thanks


Solution

  • After re-reading asl.conf man page over and over again, I've found out that i can use 'claim' command to ignore asl.conf base configuration file for my specific rule

    claim Messages that match the query associated with a 'claim' action are not processed by the main ASL configuration file /etc/asl.conf. While claimed messages are not pro-cessed processed cessed by /etc/asl.conf, they are not completely private. Other modules may also claim messages, and in some cases two or more modules may have claim actions that match the same messages. This action only blocks processing by /etc/asl.conf. The `claim' action may be followed by the keyword 'only'. In this case, only those messages that match the 'claim only' query will be processed by subsequent rules in the module.

    I followed the description of the tag 'claim' and added the following configuration to my config file :

    ? [= com.bla.bla] file /var/log/my-log
    ? [= com.bla.bla] claim