How to use “tail” in MSL log files

Have you ever needed to look at the last entries in a log file.

Of course you have.

For example you want to see the last errors in the /var/logs/mail.log file

If you open it with NANO or some other txt editing programme you will have to scroll all the way to the bottom.

AND if more entries are logged while you are already in the file you will not see them!

This is a pain

“Tail” is very useful because in its simplest form

tail /var/logs/mail.log

It will show you the last 10 lines of txt form the log file

If you add the -f command it will follow the file. Meaning if any lines are added to the log file they will appear real time

tail -f /var/logs/mail.log

Use the “-F” option to force tail to follow file names rather than file objects. This can prevent problems with log rotation and other programs that may alter file names.

Filter Lines in Followed Logs with grep

The grep tool can be combined with tail to filter the contents of a log file in real time. Consider the following examples:

tail -F procmail.log | grep -e “^Subject”
tail -F access.log | grep “404″
In the first command, only the lines of the procmail.log file that begin with the characters “Subject” are printed. All other lines are discarded.

In the second invocation, only entries from the access log that contain the characters “404″ will be printed. All other lines are discarded.

-n, –lines=N
output the last N lines, instead of the last 10

–retry, keep trying to open a file even if it is inaccessible when tail starts or if it becomes inaccessible later  useful only with -f

[hdvideo id=23]

Using putty as a socks5 proxy

You can use the MBG to VPN to a customers network but this is another trick in your box.

From your office putty into the external address of the MBG

(This has to be allowed in the remote access section of MSL)

Setup tunnels in Putty, see below, copy this and click Add. Make sure to choose “dynamic” and “Auto”

 

putty-tunnel1

 

As some of the Mitel kit requires Internet explorer(IE) i will use it as my example.

In IE choose internet options, connections,LAN settings

putty-tunnel2

 

Now you can web browse to any web site on the customer network, including the 3300, MBG, Nupoint, ETC