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