Skip to content
EuroVPSEuroVPS

How to monitor log files in a Linux server

EuroVPS FAQ

2 min read

Introduction

tail follows a log file in real time. The examples below use the mail log and cPanel domlogs.

tail Command 

tail -100  /var/log/maillog
 tailf  /var/log/maillog

# it will follow the maillog for any new entries to it and display them in terminal. You can use the command as tailf which can do the same job as ‘tail -f’

You can also use the grep command piped with tail to get only desired log output from the log file.

tail -f  /var/log/maillog  | grep -i error

 # this will output only the real time log entries from the maillog which have an ‘error’ keyword in it.

tail can be used in the below format to monitor all pop3 logins to a cPanel server in realtime.

To watch every domain's access log at once on a cPanel server, for example to see which site is taking abusive traffic:

tail -f  /usr/local/apache/domlogs/*

From the EuroVPS FAQ.

More in how to

Your next infrastructure partner

Still have
a question?

Tell us what you are trying to do. An engineer will read it and reply.

+357 222 32280
A EuroVPS engineer carrying a server node on the datacenter floor
A conversation with the people
who will look after your infrastructure.

Let’s start with your setup.

A little context helps us start the right conversation.

We’ll use your details to respond to your enquiry. Privacy policy