It is possible to set the facility field with the set-facility() rewrite function. When set, the set-facility() rewrite function will only rewrite the ${FACILITY} field in the message to the first parameter value specified in the function.
FilterX has no set_facility() counterpart. See the related set_pri() function, which sets the combined PRI value (facility * 8 + severity), so you cannot set the facility without also setting the severity.
Declaration
log {
source { system(); };
if (program("postfix")) {
rewrite { set-facility("mail"); };
};
destination { file("/var/log/mail.log"); };
flags(flow-control);
};
Parameters
The set-facility() rewrite function has a single, mandatory parameter that can be defined as follows:
set-facility( "parameter1" );
Accepted values
The set-facility() rewrite function accepts the following numeric strings and named values:
| Numerical Code | Facility name | Facility |
|---|---|---|
| 0 | kern | kernel messages |
| 1 | user | user-level messages |
| 2 | mail system | |
| 3 | daemon | system daemons |
| 4 | auth | security/authorization messages |
| 5 | syslog | messages generated internally by syslogd |
| 6 | lpr | line printer subsystem |
| 7 | news | network news subsystem |
| 8 | uucp | UUCP subsystem |
| 9 | cron | clock daemon |
| 10 | authpriv | security/authorization messages |
| 11 | ftp | FTP daemon |
| 12 | ntp | NTP subsystem |
| 13 | security | log audit |
| 14 | console | log alert |
| 15 | solaris-cron | clock daemon |
| 16-23 | local0..local7 | locally used facilities (local0-local7) |
Example usage for the set-facility() rewrite function
The following two set-facility() examples are equivalent:
rewrite {
set-facility("security");
set-facility("13");
};
Options
The set-facility() rewrite rule has the following option.
<!-- This file is under the copyright of Axoflow, and licensed under Apache License 2.0, except for using the Axoflow and AxoSyslog trademarks. -->
condition()
| Type: | filter expression |
| Default: | N/A |
Description: Applies the rewrite rule only to the messages that match the specified filter expression. Messages that don’t match the filter pass through the rule unmodified, and continue to the next element of the log path. You can use any filter expression here, and you can reference an existing filter with the filter() function. For details, see Conditional rewrites.