Technical Documentation

Configuring Tracing Operations for DHCP Processes

DHCP tracing operations track all DHCP operations and record them to a log file. By default, no DHCP processes are traced. If you include the traceoptions statement at the [edit system services dhcp] hierarchy level, the default tracing behavior is the following:

  • Important events are logged in a file called dhcpd located in the /var/log directory.
  • When the file dhcpd reaches 128 kilobytes (KB), it is renamed dhcpd.0, then dhcpd.1, and so on, until there are three trace files. Then the oldest trace file (dhcpd.2 is overwritten). For more information about how log files are created, see the JUNOS System Log Messages Reference.
  • Log files can be accessed only by the user who configures the tracing operation.

You cannot change the directory in which trace files are located. However, you can customize the other trace file settings by including the following statements at the [edit system services dhcp traceoptions] hierarchy level:

[edit system services dhcp traceoptions]file filename <files number> <match regex> <size size> <world-readable | no-world-readable>;flag {all;}

Tasks for configuring DHCP tracing operations are:

  1. Configuring the DHCP Processes Log Filename
  2. Configuring the Number and Size of DHCP Processes Log Files
  3. Configuring Access to the DHCP Log File
  4. Configuring a Regular Expression for Refining the Output of DHCP Logged Events
  5. Configuring DHCP Trace Operation Events

Configuring the DHCP Processes Log Filename

By default, the name of the file that records trace output is dhcpd. You can specify a different name by including the file statement at the [edit system services dhcp traceoptions] hierarchy level:

[edit system services dhcp traceoptions]file filename;

Configuring the Number and Size of DHCP Processes Log Files

By default, when the trace file reaches 128 kilobytes (KB) in size, it is renamed filename.0, then filename.1, and so on, until there are three trace files. Then the oldest trace file (filename.2) is overwritten.

You can configure the limits on the number and size of trace files by including the following statements at the [edit system services dhcp traceoptions] hierarchy level:

[edit system services dhcp traceoptions]file files number size size;

For example, set the maximum file size to 2 MB, and the maximum number of files to 20. When the file that receives the output of the tracking operation (filename) reaches 2 MB, filename is renamed filename.0, and a new file called filename is created. When the new filename reaches 2 MB, filename.0 is renamed filename.1 and filename is renamed filename.0. This process repeats until there are 20 trace files. Then the oldest file (filename.19) is overwritten by the newest file (filename.0).

The number of files can be from 2 through 1000 files. The file size of each file can be from 10KB through 1 gigabyte (GB).

Configuring Access to the DHCP Log File

By default, log files can be accessed only by the user who configures the tracing operation.

To specify that any user can read all log files, include the file world-readable statement at the [edit system services dhcp traceoptions] hierarchy level:

[edit system services dhcp traceoptions]file world-readable;

To set the default behavior explicitly, include the file no-world-readable statement at the [edit system services dhcp traceoptions] hierarchy level:

[edit system services dhcp traceoptions]file no-world readable;

Configuring a Regular Expression for Refining the Output of DHCP Logged Events

By default, the trace operations output includes all lines relevant to the logged events.

You can refine the output by including the match statement at the [edit system services dhcp traceoptions file filename] hierarchy level and specifying a regular expression (regex) to be matched:

[edit system services dhcp traceoptions]file filename match regex;

Configuring DHCP Trace Operation Events

By default, only important events are logged. You can configure the trace operations to be logged by including the following options at the [edit system services dhcp traceoptions] hierarchy level:

[edit dhcp system services dhcp traceoptions]flag {all;binding;config;conflict;event;ifdb;io;lease;main;misc;packet;options;pool;protocol;rtsock;scope;signal;trace;ui;}

Published: 2010-04-26