The syslog procedure enables you to send diagnostic messages to the syslog facility. It creates a character string by formatting the supplied arguments according to the formatting commands in a format control string. The resulting character string is written to the system’s syslog.
The format control string controls the formation of the character string that is written to the system’s syslog facility. It consists of two types of information: actual content and format command characters. The format command characters are used to insert and format the supplied arguments. The number of format command characters in the format control string must match the number of supplied arguments. In other words, if there are three formatting commands in the format control string, then three function arguments are required. Otherwise, an error is generated.
Starting with version 7.0.0, as an alternate to the use of syslog() function in the policy, you can use the settings syslog_accept_format, syslog_reject_format, syslogsession_start_format, syslogsession_start_fail_format, and syslogsession_finished_format in the pb.settings file. These settings format syslog messages for Accept and Reject events, and the session events Start, Finish, and Start_Fail.
For more information about these settings, please see Customized Syslog Formatting in the Privilege Management for Unix and Linux Administration Guide.
For more information on format command characters, please see Other Programming Considerations.
syslog (controlstring [,expression1, …]);
|controlstring||Required. Character string that contains the control string that is used to generate the formatted string that is passed to the syslog facility|
|expression1 …||Optional. Expressions to substitute into the formatted string|
Because syslog is a procedure, no return value is set.
In this example,
syslog ("System administrator Ids: %s %s %s", "Adm1", "Adm2", "Adm3");
System Administrator Ids: Adm1 Adm2 Adm3
is written to syslog (the syslog daemon, typically syslogd, and Privilege Management for Unix and Linux must be configured for this to work).
fprintf, print, printf, sprintf(), PowerBroker syslog setting