#!/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
