Events destined for Python processing are configured through a log ID that references a Python policy. The selection of the events are performed via a filter associated with this log ID. The remainder of the events destined for the same syslog server can bypass Python processing by redirecting them to a different log ID. The following example clarifies this point:
Creating the Python policy:
A:dut-a# configure python python-policy PyForLogEvents create
*A:dut-a>config>python>py-policy$
[no] description - Configure the description of this policy
[no] dhcp - Configure scripts to handle dhcp messages jritter
[no] dhcp6 - Configure scripts to handle dhcp6 messages
[no] diameter - Configure scripts to handle diameter messages
[no] gtpv1-c - Configure scripts to handle GTPv1-C messages
[no] gtpv2-c - Configure scripts to handle GTPv2-C messages
[no] pppoe - Configure scripts to handle PPPoE messages
[no] radius - Configure scripts to handle RADIUS messages
[no] vsd - Configure scripts to handle VSD messages
[no] syslog - Configure a script to handle outgoing syslog messages
*A:dut-a>config>python>py-policy$ syslog
- syslog script <name>
- no syslog
<name> :[32 chars max]
The detailed Python policy description is described in the 7450 ESS, 7750 SR, and VSR Triple Play Service Delivery Architecture Guide, "Python Script Support for ESM".
Log filters identify the events that are subject to Python processing:
A:dut-a>config>log# info
----------------------------------------------
filter 6
default-action drop
entry 1
action forward
match
application eq "nat"
number eq 2012
exit
exit
exit
filter 7
default-action forward
entry 1
action drop
match
application eq "nat"
number eq 2012
exit
exit
exit
Syslog destination:
syslog 1
address 192.168.1.1
exit
Applying Python syslog policy to selected events via filter 6:
log-id 33 Note: Process log events with id of 2012 with Python before
sending them to syslog server.
filter 6
from main
to syslog 1
python-policy "PyForLogEvents"
no shutdown
exit
log-id 34 Note: Log events that are not processed by Python.
filter 7
from main
to syslog 1
no shutdown
exit
In the example above, the configuration-only event 2012 from application "nat" is sent to log-id 33. All other events are forwarded to the same syslog destination via log-id 34, without any modification. As a result, all events (modified via log-id 33 and unmodified via log-id 34) are sent to the syslog 1 destination.
This configuration may cause reordering of syslog messages at the syslog 1 destination because of slight delay of messages processed by Python.