Supported Platforms
Related Documentation
- M, PTX, T Series
- Single-Chassis System Logging Configuration Overview
- M, MX, PTX, T Series
- Examples: Configuring System Logging
- QFX Series standalone switches
- Overview of Single-Chassis System Logging Configuration
- Additional Information
- Routing Matrix with a TX Matrix Plus Router Solutions Page
Specifying Log File Size, Number, and Archiving Properties
To prevent log files from growing too large, by default the Junos system logging utility writes messages to a sequence of files of a defined size. The files in the sequence are referred to as archive files to distinguish them from the active file to which messages are currently being written. The default maximum size depends on the platform type:
- 128 kilobytes (KB) for EX Series switches and J Series routers
- 1 megabyte (MB) for M Series, MX Series, and T Series routers
- 10 MB for TX Matrix or TX Matrix Plus routers
- 1 MB for the QFX Series
When an active log file called logfile
reaches the maximum
size, the logging utility closes the file, compresses it, and names
the compressed archive file logfile.0.gz
. The logging utility then opens and writes
to a new active file called logfile
. This process is also known as file rotation. When
the new logfile
reaches the configured maximum size, logfile.0.gz
is renamed logfile.1.gz
, and the new logfile
is closed, compressed, and renamed logfile.0.gz
. By default, the
logging utility creates up to 10 archive files in this manner. When
the maximum number of archive files is reached and when the size of
the active file reaches the configured maximum size, the contents
of the last archived file are overwritten by the current active file.
The logging utility by default also limits the users who can read
log files to the root user and users who have the Junos
OS maintenance permission.
Junos OS provides a configuration statement log-rotate-frequency that configures the system log file rotation frequency by configuring the time interval for checking the log file size. The frequency can be set to a value of 1 minute through 59 minutes. The default frequency is 15 minutes.
To configure the log rotation frequency, include the log-rotate-frequency statement at the [edit system syslog] hierarchy level.
You can include the archive statement to change the maximum size of each file, how many archive files are created, and who can read log files.
To configure values that apply to all log files, include the archive statement at the [edit system syslog] hierarchy level:
To configure values that apply to a specific log file, include the archive statement at the [edit system syslog file filename] hierarchy level:
archive-sites site-name specifies a list of archive sites that you want to use for storing files. The site-name value is any valid FTP URL to a destination. If more than one site name is configured, a list of archive sites for the system log files is created. When a file is archived, the router or switch attempts to transfer the file to the first URL in the list, moving to the next site only if the transfer does not succeed. The log file is stored at the archive site with the specified log filename. For information about how to specify valid FTP URLs, see Format for Specifying Filenames and URLs in Junos OS CLI Commands.
binary-data Mark file as containing binary data. This allows proper archiving of binary files, such as WTMP files (login records for UNIX based systems). To restore the default setting, include the no-binary-data statement.
files number specifies the number of files to create before the oldest file is overwritten. The value can be from 1 through 1000.
size size specifies the maximum size of each file. The value can be from 64 KB (64k) through 1 gigabyte (1g); to represent megabytes, use the letter m after the integer. There is no space between the digits and the k, m, or g units letter.
start-time "YYYY-MM-DD.hh:mm" defines the date and time in the local time zone for a one-time transfer of the active log file to the first reachable site in the list of sites specified by the archive-sites statement.
transfer-interval interval defines the amount of time the current log file remains open (even if it has not reached the maximum possible size) and receives new statistics before it is closed and transferred to an archive site. This interval value can be from 5 through 2880 minutes.
world-readable enables all users to read log files. To restore the default permissions, include the no-world-readable statement.
Related Documentation
- M, PTX, T Series
- Single-Chassis System Logging Configuration Overview
- M, MX, PTX, T Series
- Examples: Configuring System Logging
- QFX Series standalone switches
- Overview of Single-Chassis System Logging Configuration
- Additional Information
- Routing Matrix with a TX Matrix Plus Router Solutions Page
Published: 2014-07-23
Supported Platforms
Related Documentation
- M, PTX, T Series
- Single-Chassis System Logging Configuration Overview
- M, MX, PTX, T Series
- Examples: Configuring System Logging
- QFX Series standalone switches
- Overview of Single-Chassis System Logging Configuration
- Additional Information
- Routing Matrix with a TX Matrix Plus Router Solutions Page