Grep with multiple patterns used on the command

0

A few days ago I installed Centos 7 on my server and run ssh. Now I want to track logs. Is there anyway to combine cat or tail with grep to have clear failed and accepted login attempts list from a chosen day?

I know it won't work, but something like:

cat /var/log/secure | grep "Accepted" "Failed" "Today's date" 

sober

Posted 2016-08-11T09:25:03.737

Reputation: 57

Answers

1

Just:

grep '^\(Accepted\|Failed\) date' /var/log/secure

or:

grep -e Accepted -e Failed /var/log/secure | grep date

perreal

Posted 2016-08-11T09:25:03.737

Reputation: 663