Navigation
Supported Platforms
Example: Limiting Event Script Output Based on a Specific Event Type
In situations where an event policy is triggered by multiple
event types, you can limit the number of events that trigger the event
script. For example, the following event policy triggers the event-details.slax
event script whenever a ui_login_event or ui_logout_event occurs.
event-options {policy event-detail {events [ ui_login_event ui_logout_event ];then {event-script event-details.slax {output-filename systemlog;destination /tmp;}}}}
The event-details.slax
event
script writes a log file only when the ui_login_event event
occurs.
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
ns ext = "http://xmlsoft.org/XSLT/namespace";
var $event-definition = {
<event-options> {
<policy> {
<namex> "event-detail";
<eventsx> "ui_login_event";
<thenx> {
<event-scriptx> {
<namex> "event_detail.slax";
<output-filenamex> "foo";
<destinationx> {
<namex> "foo";
}
}
}
}
}
}
match / {
<event-script-resultsx> {
<event-triggered-this-policyx> {
expr event-script-input/trigger-event/id;
}
<type-of-eventx> {
expr event-script-input/trigger-event/type;
}
<process-namex> {
expr event-script-input/trigger-event/attribute-list/attribute/name;
}
}
}