Configuring Accounting-Data Log Files
An accounting profile specifies what statistics should be collected and written to a log file. To configure an accounting-data log file, include the file statement at the [edit accounting-options] hierarchy level:
filename is the name of the file in which to write accounting data.
If the filename contains spaces, enclose it in quotation marks (" "). The filename cannot contain a forward slash (;/;). The file is created in the /var/log directory and can contain data from multiple profiles.
All accounting-data log files include header and trailer sections that start with a # in the first column. The header contains the file creation time, the hostname, and the columns that appear in the file. The trailer contains the time that the file was closed.
Whenever any configured value changes that affects the columns in a file, the file creates a new profile layout record that contains a new list of columns.
You must configure the file size; all other properties are optional.
- Configuring the Storage Location of the File
- Configuring the Maximum Size of the File
- Configuring the Maximum Number of Files
- Configuring the Start Time for File Transfer
- Configuring the Transfer Interval of the File
- Configuring Archive Sites
Configuring the Storage Location of the File
On J Series Services Routers, the files are stored by default on the compact flash drive. To configure the storage location of the files in the mfs/var/log directory (on DRAM) instead of the cf/var/log directory (on the compact flash drive), include the nonpersistent statement at the [edit accounting-options file filename] hierarchy level:
This feature is useful for minimizing read/write traffic on the router’s compact flash drive.
![]() | Note: If log files for accounting data are stored on DRAM, these files are lost when you reboot the router. Therefore, you should back up these files periodically. |
Configuring the Maximum Size of the File
To configure the maximum size of the files, include the size statement at the [edit accounting-options file filename] hierarchy level:
The size statement is the maximum size of the log file, in bytes, kilobytes (KB), megabytes (MB), or gigabytes (GB). The minimum value for bytes is 256 KB. You must configure bytes; the remaining attributes are optional.
Configuring the Maximum Number of Files
To configure the maximum number of files, include the files statement at the [edit accounting-options file filename] hierarchy level:
When a log file (for example, profilelog) reaches its maximum size, it is renamed profilelog.0, then profilelog.1, and so on, until the maximum number of log files is reached. Then the oldest log file is overwritten. The minimum value for number is 3 and the default value is 10.
Configuring the Start Time for File Transfer
To configure the start time for transferring files, include the start-time statement at the [edit accounting-options file filename] hierarchy level:
The start-time statement specifies a start time for file transfer (YYYY-MM-DD.hh:mm). For example, 10:00 a.m. on January 30, 2007 is represented as 2007-01-30.10:00.
Configuring the Transfer Interval of the File
To configure the transfer interval of the files, include the transfer-interval statement at the [edit accounting-options file filename] hierarchy level:
The range for transfer-interval is 5 through 2880 minutes. The default is 30 minutes.
![]() | JUNOS Software saves the existing log file and creates a new file at the configured transfer-intervals irrespective of:
When you have a relatively smaller transfer-interval configured and if no archive site is configured, there is a possibility of losing data as JUNOS Software overwrites the log files when the maximum number of log files is reached. To ensure that the log information is saved for a reasonably long time:
|
Configuring Archive Sites
After a file reaches its maximum size or the transfer-interval time is exceeded, the file is closed, renamed, and, if you configured an archive site, transferred to a remote host. To configure archive sites, include the archive-sites statement at the [edit accounting-options file filename] hierarchy level:
site-name is any valid FTP URL. For more information about specifying valid FTP URLs, see the Junos System Basics Configuration Guide. You can specify more than one URL, in any order. When a file is archived, the router or switch attempts to transfer the file to the first URL in the list, trying the next site in the list only if the transfer does not succeed. The log file is stored at the archive site with a filename of the format router-name_log-filename_timestamp.