Tail -f master log file

is there a master log that we can ‘tail -f’ to see all web traffic hitting all websites?

There is no “master log” for all the domains but you can tail multiple files at the same time.

Example with nginx logs:

tail -f /var/log/nginx/domains/*.log

If you want to suppress headers (remove the file where the log is coming from) use -q switch

tail -qf /var/log/nginx/domains/*.log
2 Likes

im logged into the server using ‘debian’ account, this was the account that was created when the server was deployed, tried running the command and it says permission denied, see below, do i need to reset the root password via console? or is there a way around this?


sudo tail -f /var/log/apache2/domains/*.log
tail: cannot open '/var/log/apache2/domains/*.log' for reading: No such file or directory
tail: no files remaining
sudo tail -f /var/log/nginx/domains/*.log
tail: cannot open '/var/log/nginx/domains/*.log' for reading: No such file or directory

tail -f /var/log/nginx/domains/*.log
tail: cannot open '/var/log/nginx/domains/*.log' for reading: No such file or directory
tail: no files remaining
tail -f /var/log/apache2/domains/*.log
tail: cannot open '/var/log/apache2/domains/*.log' for reading: No such file or directory
tail: no files remaining

if i do a ‘dir’ it says permission denied
dir: cannot open directory ‘.’: Permission denied

Your user debian doesn’t have permissions to read those files so it can’t glob (expand) the wildcard *.log because the shell tries to glob it before executing sudo command. To solve it:

Option 1

sudo su -
tail -f /var/log/apache2/domains/*.log

Option 2

sudo sh -c 'tail -f /var/log/apache2/domains/*.log'

wow your good !

option 2 worked like a charm !!

1 Like