From bd4732f356f17bd66e48714025032fba3ecef9bb Mon Sep 17 00:00:00 2001 From: pdiogoantunes Date: Tue, 21 Mar 2017 16:44:00 +0100 Subject: [PATCH] =?UTF-8?q?version=20couleur=20pour=20requ=C3=AAtes=20IP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TipsShell.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TipsShell.md b/TipsShell.md index d2f4df64..5619fe3e 100644 --- a/TipsShell.md +++ b/TipsShell.md @@ -150,6 +150,15 @@ Avoir un compte rendu pour un laps de temps : Ou regarder les IPs en direct : +- Version simple : + ~~~ # tail -f /var/log/apache2/access.log | stdbuf -oL cut -d ' ' -f1 | uniq -c +~~~ + +- Version couleur : + +~~~ +# SEUIL=5; tail -f /var/log/apache2/access.log | stdbuf -oL cut -d ' ' -f1 | stdbuf -oL uniq -c | \ +eval "awk '\$1 > $SEUIL {printf \"\\033[1;31m\" \$1 \" \" \$2 \"\\033[0m \\n\"; next;};{printf \$1 \" \" \$2 \"\\n\";}'" ~~~ \ No newline at end of file