Configuring an SRC Component to Store Log Messages in a File (SRC CLI)

Use the following statements to configure an SRC component to store log messages in a file:

logger name file { device-filter-key device-filter-key;filter filter; filename filename; rollover-filename rollover-filename; maximum-file-size maximum-file-size; }

If you plan to filter log messages, you should be familiar with severity levels and filters for logging before you configure system logging for a component. See Categories and Severity Levels for Event Messages.

To configure component logging to a file:

  1. From configuration mode, access the configuration statement that configures the logging destination for the component.
    [edit]user@host# component-hierarchy logger name file

    For example:

    [edit]user@host# edit shared sae configuration logger sae-file-log-1 file [edit]user@host# edit snmp agent logger snmp-file-log-1 file [edit]user@host# edit slot 0 jps logger jps-file-log-1 file
  2. Specify the filter to define which event messages the software logs or disregards.
    [edit shared sae configuration logger sae-file-log-1 file]user@host# set filter filter

    If you do not specify a filter, logging to the specified file is disabled.

    Filters can specify the logging level, such as debug, or can specify expressions.

    Note: When you configure a filter, you must set appropriate values for categories and severity levels. Otherwise, the commit is not successful and when you commit the changes, a message indicating that the configured filter is invalid is displayed.

  3. (Optional) Enable network device-specific filtering for SAE debug logs based on router name, interface name, or login name.

    For more information about format rules used to define the expression while enabling network device-specific filtering, see the table SAE Debug Device Filter Formatting Rules in Categories and Severity Levels for Event Messages.

    [edit shared sae configuration logger sae-file-log-1 file]user@host# set device-filter-key device-filter-key

    Note:

    • SRC network device–specific filtering for SAE debug logs is supported on JunosE (COPS) and Junos OS (JSRC) devices.
    • The device-filter-key option is available only on the SAE component.
    • You can enable network device-specific filtering of SAE debug logs only if you set the SAE severity level to debug and then include the device-filter-key option under the shared sae …. configuration logger hierarchy level.
    • After you configure the device-filter-key option, restart the SAE for the configuration to take effect.
  4. Specify the absolute path of the filename that contains the current log files.
    [edit shared sae configuration logger sae-file-log-1 file]user@host# set filename filename

    Make sure that the user under which the J2EE application server or Web application server runs has write access to this folder. If this user does not have write access to the default folder, configure the component or application to write logs in folders to which the user has write access.

  5. (Optional) Specify the absolute path of the filename that contains the log history.
    [edit shared sae configuration logger sae-file-log-1 file]user@host# set rollover-filename rollover-filename

    When the log file reaches the maximum size, the software closes the log file and renames it. If a previous rollover file exists, the software overwrites it. The software then reopens the log file and continues to save event messages in it.

    Note: On a C Series Controller, log files are rotated according to the settings in the logrotate utility. The logrotate utility specifies how often log files are rotated and whether they are compressed.

  6. (Optional) Specify the maximum size of the log file and the rollover file.
    [edit shared sae configuration logger sae-file-log-1 file]user@host# set maximum-file-size maximum-file-size

    Note: The maximum file size is specified in KB. Maximum size of the log file is 10,000,000 KB.

    Do not set the maximum file size to a value greater than the available disk space.

Related Documentation