Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

traceoptions (Commit, Op, and SNMP Scripts)

Syntax

Hierarchy Level

Description

Define tracing operations for commit, op, and SNMP scripts.

Default

If you do not include this statement, the default operation during script execution is to log important events in the default trace file for that script type, because the traceoptions events flag is turned on by default, regardless of the configuration settings. When the file reaches 128 kilobytes (KB), it is renamed and compressed.

Note:

For op scripts, you can only customize tracing operations for local op scripts. For remote op scripts (op scripts executed using the op url command), Junos OS always logs the default trace events in the default op script log file.

Options

file filename

Name of the file to receive the output of the tracing operation. All files are placed in the directory /var/log. By default, commit script process tracing output is placed in the file cscript.log, op script process tracing is placed in the file op-script.log, and SNMP script tracing is placed in the file snmp.log. If you include the file statement, you must specify a filename. To retain the default, you can specify cscript.log, op-script.log, or snmp.log as the filename.

  • Default:

    • Commit scripts: /var/log/cscript.log

    • Op scripts: /var/log/op-script.log

    • SNMP scripts: /var/log/snmp.log

files number

(Optional) Maximum number of trace files. When a trace file named trace-file reaches its maximum size, it is renamed and compressed to trace-file.0.gz. When trace-file again reaches its maximum size, trace-file.0.gz is renamed trace-file.1.gz and trace-file is renamed and compressed to trace-file.0.gz. This renaming scheme continues until the maximum number of trace files is reached. Then the oldest trace file is overwritten.

If you specify a maximum number of files, you also must specify a maximum file size with the size option and a filename.

  • Range: 2 through 1000

  • Default: 10 files

flag flag

Tracing operation to perform. The events flag is turned on by default, regardless of the configuration settings. You can include the following flags. To specify more than one tracing operation, include multiple flag statements.

  • all—Log all operations

  • events—Log important events, including errors, warnings, progress messages, and script processing events

  • input—Log script input data

  • offline—Generate data for offline development

  • output—Log script output data

  • rpc—Log script RPCs

  • xslt—Log the XSLT library

  • Default: events

no-world-readable

Restrict file access to owner. This is the default.

size size

(Optional) Maximum size of each trace file, in kilobytes (KB), megabytes (MB), or gigabytes (GB). When a trace file named trace-file reaches this size, it is renamed and compressed to trace-file.0.gz. When trace-file again reaches its maximum size, trace-file.0.gz is renamed trace-file.1.gz and trace-file is renamed and compressed to trace-file.0.gz. This renaming scheme continues until the maximum number of trace files is reached. Then the oldest trace file is overwritten.

If you specify a maximum file size, you also must specify a maximum number of trace files with the files option and a filename.

  • Syntax: size to specify bytes, sizek to specify KB, sizem to specify MB, or sizeg to specify GB

  • Range: 10 KB through 1 GB

  • Default: 128 KB

world-readable

Enable unrestricted file access.

Required Privilege Level

maintenance—To view or add this statement in the configuration.

Release Information

Statement introduced in Junos OS Release 7.4.