Asterisk Tutorial 50 - The Asterisk Logger

pascom
4 min readJun 1, 2016

--

Welcome to the 50th episode of Introducing Asterisk, the step by step guide to Asterisk phone systems, and to celebrate we are kicking off a new topic by taking a look at the Asterisk Logger.

What is The Asterisk Logger

In the past we have used Wireshark for debugging our SIP protocols. However, not everything speaks SIP — what then? Until now, we have always used the Asterisk CLI when testing and debugging our system. By which I mean we made some changes, set the verbosity level to 3 (asterisk -rvvv), reloaded the dialplan, made a call and then analysed the CLI output.

That’s fine for testing purposes when first setting up your Asterisk phone system. But good luck using this method in a productive system — you will need the reading skills of superman. Moreover, the question of how to debug your dialplan or historical data still remains? And this where the Asterisk Logger (logger.conf) comes into play.

In a nutshell, the Asterisk Logger is a logging mechanism which can write logs to files or to the syslog system (i.e. the Asterisk Console). In order to configure the Asterisk Logger, you will need to access logger.conf as the root asterisk user using the following command:

vi etc/asterisk/logger.conf
Where vi equals your choosen Linux Text Editor.

Using The Asterisk Logger

Scroll down to the [Logfiles] section within the logger.conf configurations file. Under Logfiles, you will find a number of options (or levels as they are referred to by Asterisk) which can be included in the log file, as shown below:

These options are not all necessary, but it is good to know they exist should you need more information in your log files. Pay particular attention to the verbose option as it also provides you with the option to set the verbosity level.

It is also worth noting the syntax format is also explained in the above screenshot. When configuring your Asterisk Logger, you will need to use the following format:

filename => level options (i.e. notice,warning,error)

This is illustrated clearly by the screenshot below which was captured further on in the logger.conf configurations file.

It is also important to note that the grey lines are actually your configurable options which can be modified to match your needs, as highlighted below:

The filename “console” relates to the Asterisk console and the filename “messages” relates to an actual log file. Note that if the settings were left as above, the verbosity level would be set to whatever default level you have configured in the Asterisk Startup configurations. Therefore, for debug purposes we would suggest setting the verbosity level for the “messages” log file as explained below:

messages => notice,warning,error,verbose(3)

Our recommendation would to set a verbosity level of 3 as this will ensure that dialplan elements will also be logged and can therefore be analysed later when debugging historical issues.

Save your changes and that’s it you’re down — well almost. Don’t forget to log back into the Asterisk CLI and reload the Asterisk Logger using the command below:

logger reload

Now you are done! However, in the video above we also explain a few additional options such as Logger Rotate and so on — so worth watching it in full!

Mathias Top Tip

First up, when configuring the Asterisk Logger, we wouldn’t recommend adding a fixed verbosity level to the “console” log file. Mainly as this can always be changed using the verbosity switches as we have done in every tutorial before now.

Next up, when you are first configuring your system it could be a good idea to set the default verbosity level in the Asterisk startup configurations. However, one setup and you have ironed out the crinkles, then in order to save hard disk storage space, we would recommend setting it back to 0 or the equivalent of -r.

In order to do this, you will need to modify the verbose level in theetc/init.d/asterisk.conf to match you desired levels of verbosity.

Upgrade your business communications with a free pascom Cloud phone system today

More Info

pascom are the developers of the enterprise grade pascom VoIP phone system software. As an open standards IP PBX, pascom systems offer a cost effective alternative to proprietary solutions and provides businesses with a fully featured Unified Communications solution to boost productivity, increase mobility and reduce costs.

For more on our pascom phone system or to arrange a personalised demo, give us a call on +49 991 29691 200. Alternatively, contact us via our website or take our pascom phone system for a test drive with our Free Edition and discover first hand how your business can benefit.

Until next time — Happy VoIPing!

--

--