Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Grep logs between to 2 timestamps?

Discussion in 'General Discussion' started by Mehulo Savla, Aug 2, 2018.

  1. Mehulo Savla

    Mehulo Savla Registered

    Joined:
    Aug 2, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Am trying to grep logs between 02/Aug/2018:13:12:00 and 02/Aug/2018:13:15:59 but unable to succeed with single command.

    Please suggest if there is any single command to display logs of above timestamps.

    Regards,
    Mel
     
  2. rarod

    rarod Active Member

    Joined:
    Apr 20, 2017
    Messages:
    33
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    Can you use journalctl?. If yes:

    journalctl --since "2015-06-26 23:15:00" --until "2015-06-26 23:20:00"
     
  3. cPanelLauren

    cPanelLauren Forums Analyst II
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    3,137
    Likes Received:
    222
    Trophy Points:
    173
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,762
    Likes Received:
    116
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    The simplest solution:

    grep 02/Aug/2018:13:1[2-5]:

    This will match lines that have 02/Aug/2018:13:12:, 02/Aug/2018:13:13:, 02/Aug/2018:13:14:, and 02/Aug/2018:13:15:

    admittedly this get a bit more complicated if the time frame is narrowed down much more or more complex.
     
    rarod likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice