From: git Date: Sun, 3 May 2026 09:50:20 +0000 (-0400) Subject: initial public commit X-Git-Url: https://git.datadissipation.net/?a=commitdiff_plain;h=bbb7684778e41aec266cecb1a935f5735856d5e4;p=logtools.git initial public commit --- bbb7684778e41aec266cecb1a935f5735856d5e4 diff --git a/README.md b/README.md new file mode 100644 index 0000000..833c2b0 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +All scripts assume the default config format and the default log file structure ( regular `.log` and `.log.1` files, every other log file gzip'ed) + +### searchlog + +grep all `access.log*` files + +### esearchlog + +grep all `error.log*` files + +### chckip + +grep all `access.log*` files and perform reverse IP lookup on IPs from matched entries + +### countconn + +show connection per minute diff --git a/chckip b/chckip new file mode 100755 index 0000000..c2d8afe --- /dev/null +++ b/chckip @@ -0,0 +1,5 @@ +#!/bin/sh + +SERVER=$(which > /dev/null apache2 && printf "apache2" || which > /dev/null nginx && printf "nginx" || printf "ERROR: server not detected, needs to be set manually") + +{ zcat /var/log/"$SERVER"/access.log.*.gz; cat /var/log/"$SERVER"/access.log /var/log/"$SERVER"/access.log.1; } | grep -a "$@" | awk '{print $1}' | sort | uniq | xargs -L 1 host diff --git a/countconn b/countconn new file mode 100755 index 0000000..0652279 --- /dev/null +++ b/countconn @@ -0,0 +1,7 @@ +#!/bin/sh + +SERVER=$(which > /dev/null apache2 && printf "apache2" || which > /dev/null nginx && printf "nginx" || printf "ERROR: server not detected, needs to be set manually") + +[ "$1" -eq "$1" ] 2>/dev/null && NUM="$1" || NUM=30 + +cut -d: -f2,3 < /var/log/"$SERVER"/access.log | uniq -c | tail -n"$NUM" diff --git a/esearchlog b/esearchlog new file mode 100755 index 0000000..044f1b7 --- /dev/null +++ b/esearchlog @@ -0,0 +1,5 @@ +#!/bin/sh + +SERVER=$(which > /dev/null apache2 && printf "apache2" || which > /dev/null nginx && printf "nginx" || printf "ERROR: server not detected, needs to be set manually") + +{ zcat /var/log/"$SERVER"/error.log.*.gz; cat /var/log/"$SERVER"/error.log /var/log/"$SERVER"/error.log.1; } | grep --color=auto -a "$@" diff --git a/searchlog b/searchlog new file mode 100755 index 0000000..9d16e63 --- /dev/null +++ b/searchlog @@ -0,0 +1,5 @@ +#!/bin/sh + +SERVER=$(which > /dev/null apache2 && printf "apache2" || which > /dev/null nginx && printf "nginx" || printf "ERROR: server not detected, needs to be set manually") + +{ zcat /var/log/"$SERVER"/access.log.*.gz; cat /var/log/"$SERVER"/access.log /var/log/"$SERVER"/access.log.1; } | grep --color=auto -a "$@"