You need to use the tail command which output the last part of files in real time including all incoming logs to a standard output device such as screen. This is useful to:
- View log files in real time.
- Debug server problems.
- Troubleshoot security issues.
- Monitor spammers, ip-address, scripts and more.
tail -f file-name command syntax
The basic syntax is:
tail fileName tail /path/to/log/file tail [options] /path/to/log/file |
If your log file name is /var/log/lighttpd/access.log, enter:
tail -f /var/log/lighttpd/access.log
If your php log file name is /var/log/lighttpd/scripts.log, enter
tail -f /var/log/lighttpd/scripts.log
Sample outputs:
47 -> 400 2013-11-24 21:47:29: (request.c.622) invalid character in key GET /nixcraft/linux/docs/uniqlinuxfeatures/lsst HTTP/1.1 Host: cyberciti.biz Accept: */* Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0 FirePHP/0.7.4 /5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0 FirePHP/0.7.4 47 -> 400 |
You will get a scrolling view of the /var/log/lighttpd/scripts.log for all incoming entries on screen. To stop simply hit CTRL+C. Please note that you may need to login as root user to view log files.
Recommend readings
- HowTo: See multiple log files on UNIX / Linux console using multitail command.
- See tail(1) for more information.
how do to view this tail -f log.log on a web?
not that simple, u must use ajax.