How to read live writing logs on server

If we experience any problems on hosted website, Firs of all we have to check Apache error_log file, to know what is happening there and the facts. All the log information consistently composing, so if we want to view those file’s live update, we need to use tail command. By default, tail command will show the last 10 lines.

Options :

Two major available option are.

f : output appended data as the file grows.
n : output the last N lines, instead of the last 10.

1) How to use tail command by default ?

Use the below command to view the Apache error_log using tail command.

tail -f /usr/local/apache/logs/error_log

Logs

The above output shows only last 10 lines.

2) How to use tail command with (-n) Option ?

Use the below command to view the Apache error_log using tail command with (-n) Option.

tail -n 20 -f /usr/local/apache/logs/error_log

logs3

The above output shows only last 20 lines from Apache error_log file.

3) How to stop tail command ?

Use ctrl+c key to exit the tail command.

That’s all to do now you know how to check live written logs.You may also like to know about log location on cPanel/WHM. So, do check it out. Give your opinion below if you experience any issues or to discuss your ideas and experiences.

Leave a Reply

Your email address will not be published. Required fields are marked *