Merge pull request #47 from lbonanomi/apache_log_slice

Apache log slicing
This commit is contained in:
@trimstray 2019-01-04 18:25:57 +01:00 committed by GitHub
commit df872dff0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2222,6 +2222,12 @@ awk '!x[$0]++' filename
awk '{$1=$3=""}1' 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) ##### Tool: [sed](http://www.grymoire.com/Unix/Sed.html)