Skip to content

A collection of inspiring lists, manuals, cheatsheets, blogs, hacks, one-liners, cli/web tools and more.

Get the last 60 minutes of httpd logs from /var/log/httpd/access_log

lbonanomie76d0bb88880
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)