Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All
     

    Related Documentation

     

    syslog() Function (jcs and slax Namespaces)

    Namespaces

    http://xml.juniper.net/junos/commit-scripts/1.0http://xml.libslax.org/slax

    SLAX Syntax

    expr prefix:syslog(priority, message, <message2>, <message3> ...);

    XSLT Syntax

    <xsl:value-of select="prefix:syslog(priority, messsage, <message2>, <message3>)"/>

    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.

    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 message 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 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 system log file.

    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 1 and Table 2 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 1: Facility Strings

    Facility StringDescriptionNumeric 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 2: Severity Strings

    Severity StringDescriptionNumeric 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

    Usage Examples

    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 arguments. For this case, the concatenated string "mymessage mymessage2" is output to the system log file.

    expr jcs:syslog("pfe.alert", "mymessage ", "mymessage2");
     

    Related Documentation

     

    Published: 2013-03-05