This commit is contained in:
Manuel Friedli 2020-06-16 11:09:19 +02:00
parent 31d67ed735
commit 172a8a92a4
1 changed files with 4 additions and 2 deletions

View File

@ -1,11 +1,12 @@
#!/bin/sh
input_files=/var/log/apache2/access_*.log
date="14/Jun/2020:18:"
tmpdir=$(mktemp -d)
cd "${tmpdir}"
cut -d' ' -f1 ${input_files} | sort > all.txt
grep -h "${date}" ${input_files} | cut -d' ' -f1 | sort > all.txt
grep ':' all.txt > raw-ipv6.txt
grep -v ':' all.txt > raw-ipv4.txt
@ -16,4 +17,5 @@ cut -d. -f1-3 raw-ipv4.txt | sort | uniq -c | sort -n > sorted-ipv4-24.txt
cut -d. -f1-2 raw-ipv4.txt | sort | uniq -c | sort -n > sorted-ipv4-16.txt
cut -d. -f1 raw-ipv4.txt | sort | uniq -c | sort -n > sorted-ipv4-8.txt
chmod o+rx "${tmpdir}"
echo "Have fun in ${tmpdir}!"