Can't view log files on Ubuntu 15.0 [solved]

I'm messing with firewall configurations in Ubuntu 15.0 and can't view the firewall logs. I'm trying to use the commands:
/var/log/syslog and I get "permission denied"
I've also tried sudo /var/log/syslog and get "command not found"

Other commands I've tried were:
/var/log/ufw* with and without sudo but get the same errors as above.

The firewall is turned on a logging is enabled. I'm on the admin account with root access. I've googled and haven't found much help. Any ideas?

You need to open the log file with a text editor to see it. Run either sudo nano /var/log/syslog or sudo cat /var/log/syslog. First command will open it with the nano text editor and the second will output the log directly in the terminal.

1 Like

Damn, beat me too it.

2 Likes

YESSSS! Sorry, just letting my noob flag fly. Worked perfectly. Thanks!

1 Like

Happy to help, we were all new to this at some point.

You also have tail -f /var/log/whatever which will show the end of and keep showing any new log lines
and journalctl for logs which i think ubuntu also uses (though maybe not 15.0?)

edit:

head -n <number> /var/log/file will show the start of a file up to whatever specified lines (tail also does this, same format)
grep -i "words to find" /var/log/file if i didnt mess up the syntax will search a file for those words. Useful for example if you want to see Xorg errors search for "EE"

3 Likes

journalctl should work in 15.04 and above as they ship with systemd.

1 Like