summaryrefslogtreecommitdiff
path: root/ar/.local/bin/ylog
blob: ff4083e212c9d135bcce85766a91a3ac249facdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
"