I would like to see the output in a logfile greped by only one domain but also the following two lines.
Example:
tail -f /var/log/apache2/modsec_audit.log |grep mydomain.de
this shows all lines, that contain "mydomain.de" but the important information is in the line below the line, where the domain is included
Best Answer
grep has extra options to define how many lines before and after the result:
-A
(after)-B
(before)-C
(context [before + after])So in your case you need
-A
:the above command prints
NUMBER
of lines afterYOURDOMAIN
in file.