Glam Prestige Journal

Bright entertainment trends with youth appeal.

I need logs only from 09:36 to 09:39 in server logs where the timestamp is 2019-03-19T09:37:19 like this. Can anyone suggest me grep command for this

1

2 Answers

grep '2019-03-19T09:3[6-9]' /var/log/syslog

Because you said your timestamp is 2019-03-19T09:37:19. I suggest you do:

  1. Press CTRL + ALT + T.
  2. Run the command (-E for extended regex):

    sudo grep -E '2019-03-19T09:3[6-9]' <file or file_path>

To be direct, the above command could be (if run immediately after CTRL + ALT + T or another path):

sudo grep -E '2019-03-19T09:3[6-9]' /var/log/syslog

Or (if in /log/ folder already...):

sudo grep -E '2019-03-19T09:3[6-9]' syslog

I hope that's clear enough to help!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy