SRX Services Gateway
SRX Services Gateway

Event-options question ?

a week ago

Hi, Guys,

 

I create a event-option to record the RPM results every 5 minutes, how could I append all results int the same files ( as the traceoption file, file size, and zipping files ) ?

 

set event-options generate-event ping time-interval 300
set event-options policy Policy1 events ping
set event-options policy Policy1 then execute-commands commands "show service rpm history-results"
set event-options policy Policy1 then execute-commands output-filename RPM_status.txt
set event-options policy Policy1 then execute-commands output-format text
set event-options policy Policy1 then execute-commands destination local-directory
set event-options destinations local-directory archive-sites /var/log/

 

 

Thanks a lot

 

 

 

 

 

 

 

6 REPLIES 6
SRX Services Gateway

Re: Event-options question ?

a week ago

Hello Ben,

 

You can achieve this by using the append option in cli.

 

set event-options policy Policy1 then execute-commands commands "show service rpm history-results | append /var/log/RPM_status.txt"

 

With this you would not need to specify the output-file format,destination etc.

 

I hope this helps. Regards,

 

Vikas

SRX Services Gateway

Re: Event-options question ?

a week ago

Hi Ben,

 

 The following KB was recently created to accomplish that task:

https://kb.juniper.net/InfoCenter/index?page=content&id=KB35268

 

Please mark as resolved if it helped you with your concern.

Thanks!

SRX Services Gateway

Re: Event-options question ?

[ Edited ]
Sunday

Hi, Nelumbo,

 

This is a good tool, thanks so much for your advice.

 

But "commit" does not work If I remove the following commands :

1. set event-options policy Policy1 then execute-commands output-filename RPM_status
2. set event-options policy Policy1 then execute-commands destination local-directory
3. set event-options policy Policy1 then execute-commands output-format text
4. set event-options destinations local-directory archive-sites /var/log/

 

 

Also, due to the file "RPM_status" is increasing unlimitely, can I :

1. zip the file evey day

2. set 10 pcs of zipped file at max

3. wipe out the oldest files

4. so they are in turn

 

I want to keep the rpm test and records up to around 10 days 

 

How to achieve this requirement ?

 

Many thanks

SRX Services Gateway

Re: Event-options question ?

[ Edited ]
Sunday

Hello Ben,

 

I was able to commit with this configuration. Here is a sample from my lab running 15.1.

 

I believe you would need to use the event ping_test_completed rather than ping, secondly the archive options for a specific file can be set under system syslog.

 

set event-options policy Policy1 events ping_test_completed 
set event-options policy Policy1 then execute-commands commands "show service rpm history-results | append /var/log/RPM_status.txt"

set system syslog file history-results archive files 10 size 5M

 

I hope this helps. Regards,

 

Nelumbo

SRX Services Gateway

Re: Event-options question ?

[ Edited ]
Monday

Hi, Nelumbo,

 

Your configuration can be committed, but no record/result is captured and saved.

 

My configuration is below:

root@AASRX1> show configuration event-options | display set
set event-options generate-event ping_test_completed time-interval 300
set event-options policy WANLinkPingTest events ping_test_completed

set event-options policy WANLinkPingTest then execute-commands commands "show service rpm history-results | append /var/log/troubleshoot/RPM_status.txt"
set event-options policy WANLinkPingTest then execute-commands output-filename RPM_status.txt
set event-options policy WANLinkPingTest then execute-commands destination local-directory
set event-options policy WANLinkPingTest then execute-commands output-format text
set event-options destinations local-directory archive-sites /var/log/troubleshoot/

 

The results:

1. "RPM_status.txt" .. contains the wanted results

2. " AASRX1_20191202_052012_RPM_status.txt" .....when I cat the file ( all these files have the same contents ), the result is below:

 

% cat AASRX1_20191202_052012_RPM_status.txt

    root@AASRX1> show service rpm history-results | append /var/log/troubleshoot/RPM_status.txt

    Wrote 751 lines of output to '/var/log/troubleshoot/RPM_status.txt'
    %

 

 

 

 

 

 

 

 

 

 


How I configure "set system syslog file history-results archive files 10 size 5M" for my log folder, thx ?

 


@Nelumbo wrote:

Hello Ben,

 

I was able to commit with this configuration. Here is a sample from my lab running 15.1.

 

I believe you would need to use the event ping_test_completed rather than ping, secondly the archive options for a specific file can be set under system syslog.

 

set event-options policy Policy1 events ping_test_completed 
set event-options policy Policy1 then execute-commands commands "show service rpm history-results | append /var/log/RPM_status.txt"

set system syslog file history-results archive files 10 size 5M

 

I hope this helps. Regards,

 

Nelumbo




SRX Services Gateway

Re: Event-options question ?

Monday

Hi, Egerro,

 

Thanks for your kind document and information,

 

If your configuration can append the wanted results to the same file "event-result" until some limits/conditions ?

 

Thanks a lot