Junos OS

Expand all | Collapse all

Searching multiple logs files from single show match statement

Jump to Best Answer
  • 1.  Searching multiple logs files from single show match statement

    Posted 12-10-2019 08:09

    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 !



  • 2.  RE: Searching multiple logs files from single show match statement

    Posted 12-10-2019 08:17

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

     

     



  • 3.  RE: Searching multiple logs files from single show match statement
    Best Answer

     
    Posted 12-10-2019 08:20

    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.



  • 4.  RE: Searching multiple logs files from single show match statement

    Posted 12-10-2019 11:23

    Yes that works 100 !!!

     

    Much appreciated !

     



  • 5.  RE: Searching multiple logs files from single show match statement

    Posted 12-11-2019 13:09

    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