apple logger (ASL) 忽略 /etc/asl.conf 中特定设施的规则

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

我有一个发送 asl 日志消息的 C/C++/Objective-C 项目。

asl.conf 中的默认配置会将所有级别高于通知的日志消息路由到系统日志(请参阅下面的规则),我只想为我的特定设施取消此规则。

这意味着,我设施下的所有日志消息将只路由到我的日志文件,而不是 system.log。

这是我的设施被定义为 com.bla.bla 的配置 asl.conf ? [<=等级通知]文件system.log

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

我试过跳过和忽略,但我没有做任何改变。唯一可行的是从 asl.conf 中删除规则,但我不想更改其他进程/设施的行为并修改一些默认规则。

是否可以添加任何规则来禁止来自 system.log 的消息?

感谢

在 re-reading asl.conf man page 一遍又一遍之后,我发现我可以使用 'claim' 命令来忽略我的 asl.conf 基本配置文件具体规则

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.

我按照标签 'claim' 的描述添加了以下配置到我的配置文件中:

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