summaryrefslogtreecommitdiff
path: root/ar/.local/bin/ylog
diff options
context:
space:
mode:
Diffstat (limited to 'ar/.local/bin/ylog')
-rwxr-xr-xar/.local/bin/ylog25
1 files changed, 25 insertions, 0 deletions
diff --git a/ar/.local/bin/ylog b/ar/.local/bin/ylog
new file mode 100755
index 0000000..ff4083e
--- /dev/null
+++ b/ar/.local/bin/ylog
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+HOST="root@thesiah.xyz"
+LOG_DIR="/var/log/nginx"
+target="${1:-207.96.105.230}"
+
+esc_target=$(printf '%s' "$target" | sed -E 's/[][^$.*/+?(){}|\\]/\\&/g')
+
+ssh "$HOST" "
+ for f in $LOG_DIR/recordings* $LOG_DIR/access*; do
+ [ -e \"\$f\" ] || continue
+ case \"\$f\" in
+ *.gz)
+ zgrep -E \"${esc_target}[[:space:]]\" \"\$f\" \
+ | grep -v '59.19.56.8' \
+ | grep -vi 'firefox'
+ ;;
+ *)
+ grep -E \"${esc_target}[[:space:]]\" \"\$f\" \
+ | grep -v '59.19.56.8' \
+ | grep -vi 'firefox'
+ ;;
+ esac
+ done
+"