jcs:syslog() Function
Syntax
jcs:syslog(priority, message, <message2>, <message3> ...)
Description
Log messages with the specified priority to the system log file. The priority can be expressed as a facility.severity string or as a calculated integer. The message argument is a string or variable that is written to the system log file. Optionally, additional strings or variables can be included in the argument list. The message argument is concatenated with any additional parameters, and the concatenated string is written to the system log file. The syslog file is specified at the [edit system syslog] hierarchy level of the device configuration file.
Parameters
- message—String or variable that is output to the system log file.
- message2—(Optional) Any additional number of strings or variable names passed as arguments to the function. These are concatenated with the message argument and output to the syslog.
- priority—Priority
given to the syslog message. The priority can be specified as a facility.severity string,
or it can expressed as an integer calculated from the corresponding
numeric values of the facility and severity strings. Table 6 and Table 7 show the facility and severity
strings available and their corresponding numeric values.
The integer value of the priority parameter is calculated by multiplying the facility string numeric value by 8 and adding the severity string numeric value. For example, if the facility.severity string pair is "pfe.alert", the priority value is 161 ((20 x 8)+1).
Table 6: Facility Strings
Facility String Description Numeric Value auth
Authorization system
4
change
Configuration change log
22
conflict
Configuration conflict log
21
daemon
Various system processes
3
external
Local external applications
18
firewall
Firewall filtering system
19
ftp
FTP processes
11
interact
Commands executed by the UI
23
pfe
Packet Forwarding Engine
20
user
User processes
1
Table 7: Severity Strings
Severity String Description Numeric Value alert
Conditions that should be corrected immediately
1
crit
Critical conditions
2
debug
Debug messages
7
emerg or panic
Panic conditions
0
err or error
Error conditions
3
info
Informational messages
6
notice
Conditions that should be specially handled
5
warn or warning
Warning messages
4
The following three examples log pfe messages with an alert priority. The string "mymessage" is output to the system log file. All three examples are equivalent:
expr jcs:syslog("pfe.alert", "mymessage");
expr jcs:syslog(161, "mymessage");
var $message = "mymessage";
expr jcs:syslog("pfe.alert", $message);
The following example logs pfe messages with an alert priority similar to the previous example. In this example, however, there are additional string parameters. For this case, the concatenated string "mymessage mymessage2" is output to the system log file.
expr jcs:syslog("pfe.alert", "mymessage ", "mymessage2");
Hide Navigation Pane
Show Navigation Pane
Download
SHA1