Page tree
Skip to end of metadata
Go to start of metadata

Asterisk Logfiles

The Asterisk Logfiles Module is an easy way to view portions of the Asterisk Log.  However, this Module is only useful when you want to view a very recent event in the Asterisk Log.  

For a more detailed view of your Asterisk Logfiles, access the command prompt of the machine that you installed Asterisk on.  You can do so by physically accessing the machine, or by using an SSH client to access the command prompt from another machine.  If you are using a Windows machine, you can use a free program called Putty to access the command prompt.  You can download Putty here.  Putty has an added advantage in that you can easily cut and paste to and from Putty, and you cannot do so while accessing the command line from the machine that hosts your PBX.

Log-in to your machine using the username "root" and the root password when you set-up your machine.

After you log-in, you can access the logfiles by typing:

cd /var/log/asterisk

at the command prompt.

To see a list of the logfiles, type:

ls -l

at the command prompt.

Typically, today's logfile is called "full" and logfiles from prior days are named "" or full-xxx", where xxx is a number of some kind.

If you want to view and search today's logfiles in a text editor, type:

nano full

at the command prompt.  This will open up the logfile in a text editor called "nano."  

Nano will show you the commands you can use at the bottom of the screen.  The caret (^) character before a command indicates that you should hit the CTRL button.  In other words "^G  Get Help" means that you should hit CTRL-G to get to Nano's help screen.

You can then page up or down, and use CTRL-W to search the Logfile.  When you're done, hit CTRL-X to exit.

If you want to open a prior day's logfiles, replace the word "full" in the example above with the name of the file.  

Note:  If you inadvertently save the Logfile, Asterisk may stop logging for the day.  If you do so, you can reset Asterisk and FreePBX by typing:

amportal restart

Note:  This command will wait up to 120 seconds for all calls to end.  If the calls have not ended within 120 seconds, they will be terminated.  You can change the amount of time that the system will wait before terminating the calls in the Advanced Settings Module.

Another way to easily view logfile information is to use the Linux grep command.  For example, to view a list of all the entries in today's logfile indicating that a Trunk is lagged or UNREACHABLE, you could type:

grep "is now" full

at the command prompt.  

Note:  the grep command is case sensitive.  So, "Lagged" will not pull up entries that say "lagged" or "LAGGED".  Also, as above, if you want to view prior day's logfiles, replace full with the name of the logfile.

If the results are too long, you can use grep to put the "is now" entries in a new file that you can then view in nano.  For example, to copy all entries in today's logfile that contain "is now" into a file called tempfile, type:

grep "is now" full > tempfile

at the command prompt.  

To view the file, type:

nano tempfile

While in nano, you can use CTRL-W to search, and <PAGE UP> and <PAGE DOWN> to page up and page down.  CTRL-W followed by CTRL-V will take you to the last line in the Log.

When you're done in nano, hit CTRL-X to exit.  

You can delete the tempfile by typing:

rm tempfile

You can also view the Asterisk log in real-time by entering the Asterisk Command Line Interface:

asterisk -r

To exit, type


Alternatively, you can view the logfile in real-time using tail:

cd /var/log/asterisk

tail -f full

When you're done, hit CTRL-C to exit.

  • No labels