]> git.nbdom.net Git - awstats.git/commitdiff
bin/awstats-logs master
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 7 Sep 2016 14:37:37 +0000 (15:37 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 7 Sep 2016 14:37:37 +0000 (15:37 +0100)
bin/awstats-logs [new file with mode: 0755]

diff --git a/bin/awstats-logs b/bin/awstats-logs
new file mode 100755 (executable)
index 0000000..3db8992
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+DAYS=7
+
+if [ "$1" = "--days" ]; then
+  shift
+  DAYS="$1"; shift
+fi
+
+SERVERS=${1//,/ }; shift
+DIR=$1; shift
+#exec echo $SERVERS
+#exec /usr/share/awstats/tools/logresolvemerge.pl /tmp/ios.log
+
+(
+
+  for s in $SERVERS; do
+    ssh $s "find $DIR/*access_log* -mtime -$DAYS -type f -printf '%T@\t%p\n'| sed 's/^\([0-9]\+\)\.[0-9]\+/\1/' | sort -k1 -n | cut -f 2 | xargs gzip -cdfq 2>/dev/null"
+  done
+
+) | /usr/share/awstats/tools/logresolvemerge.pl 'cat |'