Tracing Extended DHCP Relay Agent Operations
The extended DHCP tracing operations track all extended DHCP relay agent operations and record them in a log file. The logged error descriptions provide detailed information to help you solve problems faster.
By default, nothing is traced. If you include the traceoptions statement at the [edit forwarding-options dhcp-relay] hierarchy level, the default tracing behavior is the following:
- Important events are logged in a file called jdhcpd located in the /var/log directory. You cannot change the directory (/var/log) in which trace files are located.
- When the file jdhcpd reaches 128 kilobytes (KB), it is renamed jdhcpd.0, then jdhcpd.1, and so on, until there are three trace files. Then the oldest trace file (jdhcpd.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.
To trace the extended DHCP relay agent operations, include the traceoptions statement at the [edit forwarding-options dhcp-relay] hierarchy level:
- [edit forwarding-options dhcp-relay]
-
traceoptions {
- flag all;
- flag auth;
- flag database;
- flag state;
- flag interface;
- flag rtsock;
- flag packet;
- flag packet-option;
- flag io;
- flag ha;
- flag ui;
- flag general;
- flag fwd;
- flag rpd;
- flag session-db;
-
- file file-name {
- <files number>;
- <size maximum-file-size>;
- <match regex>;
- <(world-readable | no-world-readable)>;
- }
- }
The extended DHCP relay agent traceoptions statements are described in the following sections:
- Configuring the Extended DHCP Relay Agent Log Filename
- Configuring the Number and Size of Extended DHCP Relay Agent Log Files
- Configuring Access to the Extended DHCP Relay Agent Log File
- Configuring a Regular Expression for Extended DHCP Relay Agent Lines to Be Logged
- Configuring the Extended DHCP Relay Agent Tracing Flags
Configuring the Extended DHCP Relay Agent Log Filename
By default, the name of the file that records trace output is jdhcpd. You can specify a different name by including the file statement at the [edit forwarding-options dhcp-relay traceoptions] hierarchy level:
- file filename;
Configuring the Number and Size of Extended DHCP Relay Agent 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 forwarding-options dhcp-relay traceoptions] hierarchy level:
- file file-name 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 tracing 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 10 KB through 1 gigabyte (GB).
Configuring Access to the Extended DHCP Relay Agent 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 forwarding-options dhcp-relay traceoptions] hierarchy level:
- file file-name world-readable;
To explicitly set the default behavior, include the file no-world-readable statement at the [edit forwarding-options dhcp-relay traceoptions] hierarchy level:
- file file-name no-world-readable;
Configuring a Regular Expression for Extended DHCP Relay Agent Lines to Be Logged
By default, the trace operation output includes all lines relevant to the logged events.
You can refine the output by including the file match statement at the [edit forwarding-options dhcp-relay traceoptions] hierarchy level and specifying a regular expression (regex) to be matched:
- file file-name match regex;
Configuring the Extended DHCP Relay Agent Tracing Flags
By default, only important events are logged. You can configure the trace operations to be logged by including the flag statement at the [edit forwarding-options dhcp-relay traceoptions] hierarchy level:
- flag flag;
where flag is one of the following extended DHCP relay agent tracing flags:
- all—Trace all events
- auth—Trace authentication events
- database—Trace database events
- fwd—Trace firewall process events
- general—Trace miscellaneous events
- ha—Trace high availability-related events
- interface—Trace interface operations
- io—Trace I/O operations
- packet—Trace packet decoding operations
- packet-option—Trace DHCP option decoding operations
- rpd—Trace routing protocol process events
- rtsock—Trace routing socket operations
- session-db—Trace session database events
- state—Trace changes in state
- ui—Trace user interface operations
To display the end of the log, issue the show log (jdhcpd | last) operational mode command:
- [edit]
- user@host# run show log (jdhcpd | last)
