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 Junos device. 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, configure one or more destinations specifying the archive sites to which the files are uploaded. To upload the files when the device executes an event policy, you must reference the configured destinations within an event policy.

This example configures a new archive destination named mgmt-archives, which can be referenced in event policies for file archiving. The example configures two archive sites for this destination. The first site is the Secure Copy URI "scp://username@example.com/test" for which a password is configured. The second site is a directory on the local device. The device attempts to transfer 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.

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 can be referenced by event policies.

  1. Configure the identifier and associated archive sites for each 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. (Optional) Configure the transfer delay, in seconds, associated with each destination. The mgmt-archives destination has a transfer delay of five seconds.

  4. Commit the configuration.

  5. You can reference configured destinations in an event policy. For information about referencing destinations in event policies, see Example: Configuring 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. You can now reference this destination in event policies. 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 upload the files to the /var/log archive site.

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