From e76d0bb88880f4f76ac839550cab7e39ed38f467 Mon Sep 17 00:00:00 2001 From: lbonanomi Date: Fri, 4 Jan 2019 07:38:37 -0500 Subject: [PATCH] Get the last 60 minutes of httpd logs from /var/log/httpd/access_log --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index dcd30b1..d0cf496 100644 --- a/README.md +++ b/README.md @@ -2222,6 +2222,12 @@ awk '!x[$0]++' filename awk '{$1=$3=""}1' filename ``` +###### Get the last hour of Apache logs + +```bash +awk '/'$(date -d "1 hours ago" "+%d\\/%b\\/%Y:%H:%M")'/,/'$(date "+%d\\/%b\\/%Y:%H:%M")'/ { print $0 }' /var/log/httpd/access_log +``` + ___ ##### Tool: [sed](http://www.grymoire.com/Unix/Sed.html)