syslog() Function (Python, SLAX, and XSLT)
Namespaces
http://xml.juniper.net/junos/commit-scripts/1.0 http://xml.libslax.org/slax
Python Syntax
jcs.syslog(priority, message, <message2>)
SLAX Syntax
expr prefix:syslog(priority, message, <message2>);
XSLT Syntax
<xsl:value-of select="prefix:syslog(priority, messsage, <message2>)"/>
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 that is written to the system log file. Optionally,
additional strings can be included in the argument list. The message
argument is concatenated
with any additional arguments, 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 configuration.
The prefix associated with the namespace URI should be defined in the prefix-to-namespace mapping in the style sheet.
Parameters
message |
String that is output to the system log file. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
message2 |
(Optional) Any additional number of strings
passed as arguments to the function. These are concatenated with the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
priority |
Priority given to the syslog message. The priority can be specified as a Table 1 and Table 2 show the available
facility and severity strings and their corresponding numeric values.
The integer value of the
|
Usage Examples
The following three SLAX 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 arguments. For this case, the
concatenated string "mymessage mymessage2
" is output to the system log file.
expr jcs:syslog("pfe.alert", "mymessage ", "mymessage2");
Similarly, in Python:
jcs.syslog("pfe.alert", "message") jcs.syslog("161", "message")
Release Information
Function introduced in Junos OS Release 7.6
Support for the slax namespace http://xml.libslax.org/slax added in Junos OS Release 12.2.
Support for Python added in Junos OS Release 16.1R1.