Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Define Destinations for File Archiving by Event Policies

This example configures an archive site for event policies. Event policy actions that reference the configured destination upload specified files to that site.

Requirements

This example uses a device running Junos OS Release 26.2R1 or a device running Junos OS Evolved Release 26.2R1.

No additional configuration beyond device initialization is required before configuring this example.

Overview

When an event policy action generates output files, you can archive the files for later analysis. Similarly, you might want to archive system files, including system log files, core files, and configuration files, from the time an event occurs.

When an event occurs, you can upload relevant files to a specified location. To archive files from an event policy, you must first configure one or more destinations specifying the archive sites to which the files are uploaded. You must then reference the destination in the event policy.

This example configures a new archive destination named mgmt-archives that has two archive sites. The first site is the SCP URI "scp://admin@example.com/test". The device connects to the remote site using the mgmt_junos routing instance and the configured password. The second site is a directory on the local device. The device attempts to transfer a file to the first archive site in the list, moving to the next site only if the transfer to the first site fails.

The example configures a transfer delay of five seconds for all files uploaded to the mgmt-archives archive site. This option instructs the device to wait for five seconds before uploading the files to the destination.

Configuration

Procedure

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them in a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level:

Step-by-Step Procedure

Configure a new archive destination named mgmt-archives that event policies can reference.

  1. Configure the identifier and associated archive sites for the destination.

    The device transfers to the first archive site in the list, moving to the next site only if the transfer to the first site fails.

  2. If an archive site requires authentication, configure the required plain-text password for that site.

  3. If an archive site is reachable through a specific routing instance, configure the routing instance name.

  4. (Optional) Configure the transfer delay, in seconds, associated with the destination. The mgmt-archives destination has a transfer delay of five seconds.

  5. Commit the configuration.

  6. You can reference configured destinations in an event policy. For information about referencing destinations in event policies, see Example: Configure an Event Policy to Upload Files and Configure an Event Policy to Execute Operational Mode Commands.

Verification

Verifying the Configuration

Purpose

Issue the show configuration event-options operational mode command to review the resulting configuration.

Action

Meaning

In the sample output, the mgmt-archives destination has two archive sites and a transfer delay of five seconds. When you reference the mgmt-archives destination in an event policy, the device uploads the specified files to the first archive site after a five second delay. If the transfer to the first archive fails, the device attempts to transfer the files to the /var/log directory.

Note that although the plain-text password is visible when you configure it, the configuration displays the encrypted password.