I am new to this can you guide me how to capture the data from /var/log/messages based on some keywords and want to see the messages on dashboard/send an email.
- need to read the /var/log/messages for keywords like 'restart'/'event'
- capture the data from that message (above 5 lines and below 5 lines)
- captured data need to be written in to log file with timestamp
- that file need to be sent to mail
could you please help me how to do this basic code. I will enhance based on my requirement