Junos
Junos

Searching multiple logs files from single show match statement

‎12-10-2019 08:09 AM

I'm currently working on EX devices generating a large number of logs. For compliance puropses the logs are expected and in itself that isn't a problem for me.

 

I was wondering if there was a method to, for example, search for BGP events taken from multiple log files using single 'match' :

 

messages.gz

messages.0.gz

messages.1.gz

messages.2.gz

...

..

So on and so forth till .9.gz.

 

Thanks in advance !

Ajaz Nawaz
JNCIE-SEC#254 | CCIE#15721
JNCIA-FWV | JNCIS-FWV
JNCIA-JUNOS | JNCIS-SEC
JNCIP-SEC | JNCIE-SEC
CCNP-Collaboration
4 REPLIES 4
Junos

Re: Searching multiple logs files from single show match statement

‎12-10-2019 08:16 AM

AFAIK, there is no CLI command to achieve the desired result. You may use shell command: zgrep -a 'search pattern' messages*

 

 

Thanks,
Nellikka
JNCIE x3 (SEC #321; SP #2839; ENT #790)
Please Mark My Solution Accepted if it Helped, Kudos are Appreciated too!!!
Junos
Solution
Accepted by topic author anawaz
‎12-10-2019 11:24 AM

Re: Searching multiple logs files from single show match statement

‎12-10-2019 08:20 AM

Hi,
you can try from shell 

> start shell

cd /var/log

zcat messages.* | grep 

 

If this solves your problem, please mark this post as "Accepted Solution.

Regards,
A.A.
Junos

Re: Searching multiple logs files from single show match statement

[ Edited ]
‎12-10-2019 11:23 AM

Yes that works 100 !!!

 

Much appreciated !

 

Ajaz Nawaz
JNCIE-SEC#254 | CCIE#15721
JNCIA-FWV | JNCIS-FWV
JNCIA-JUNOS | JNCIS-SEC
JNCIP-SEC | JNCIE-SEC
CCNP-Collaboration
Junos

Re: Searching multiple logs files from single show match statement

‎12-11-2019 01:09 PM

In case you need to do this frequently, then SLAX script might be a more convenient option as you don't need to leave the Junos cli: https://github.com/jumation/cat-messages