Example: Configuring the Delay Before Files Are Uploaded by an Event Policy
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. You can configure an event policy to upload relevant files to a specified location for analysis. By default, the event policy immediately uploads the files. However, you can configure a transfer delay, which causes the event process (eventd) to wait a specified number of seconds before beginning to upload one or more files. The transfer delay helps ensure that a large file, such as a core file, is completely generated before the upload begins. The following event policies are configured with a transfer delay:
Example 1
Configure two event policies, policy1
and policy2
. The policy1
event policy has a 5-second
transfer-delay when uploading the process.core file to the some-dest
destination. The policy2
event policy has no transfer delay when uploading the process.core file to the same destination.
[edit event-options] policy policy1 { events e1; then { upload filename process.core destination some-dest { transfer-delay 5; } } } policy policy2 { events e2; then { upload filename process.core destination some-dest; } } destinations { some-dest { archive-sites { "scp://robot@my.little.com/foo/moo" password "password"; "scp://robot@my.big.com/foo/moo" password "password"; } } }
Example 2
The policy1
event policy has a 7-second (5 seconds
+ 2 seconds) transfer delay when uploading the process.core
file to the destination. The policy2
event policy has
a 2-second transfer delay when uploading the process.core file to the destination.
[edit event-options] policy policy1 { events e1; then { upload filename process.core destination some-dest { transfer-delay 5; } } } policy policy2 { events e2; then { upload filename process.core destination some-dest; } } destinations { some-dest { transfer-delay 2; archive-sites { "scp://robot@my.little.com/foo/moo" password "password"; "scp://robot@my.big.com/foo/moo" password "password"; } } }
Example 3
The policy1
event-policy is executed with user1
privileges and uploads the process.core file after a transfer delay of 7 seconds (5 seconds +
2 seconds). The policy2
event policy is executed
with root
privileges and uploads the process.core file after a transfer delay of 6 seconds (4 seconds +
2 seconds).
[edit event-options] policy policy1 { events e1; then { upload filename process.core destination some-dest { transfer-delay 5; user-name user1; } } } policy policy2 { events e2; then { upload filename process.core destination some-dest { transfer-delay 4; } } } destinations { some-dest { transfer-delay 2; archive-sites { "scp://robot@my.little.com/foo/moo" password "password"; "scp://robot@my.big.com/foo/moo" password "password"; } } }