|
|
第1行: |
第1行: |
| '''Asterisk Logfiles''' <br/> | | '''Asterisk Logfiles''' <br/> |
− | 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. <br/>
| |
| | | |
− | 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. <br/>
| + | Asterisk logfile 模块支持非常方便的查看手段来检查Asterisk的日志。 但是这个模块仅支持最近asterisk 事件。<br/> |
− | Log-in to your machine using the username "root" and the root password when you set-up your machine. <br/>
| + | |
− | After you log-in, you can access the logfiles by typing: <br/>
| + | 更多详细的日志文件记录,用户可以通过SSH 登录到PBX服务器来进行查看。<br/> |
| + | 使用SSH登录到PBX服务器,用户名称为root 帐号和root密码。<br/> |
| + | 登录后,用户可以看到各种asterisk日志文件<br/> |
| cd /var/log/asterisk <br/> | | cd /var/log/asterisk <br/> |
| at the command prompt. <br/> | | at the command prompt. <br/> |
| To see a list of the logfiles, type: <br/> | | To see a list of the logfiles, type: <br/> |
| ls -l <br/> | | ls -l <br/> |
− | at the command prompt. <br/>
| |
| | | |
− | Typically, today's logfile is called "full" and logfiles from prior days are named "full.xxx" or full-xxx", where xxx is a number of some kind. <br/>
| + | 通常情况下,文件命名以"full" 和日期命名,例如 "full.xxx" 或者 full-xxx",这里xxx 是日期时间。<br/> |
− | If you want to view and search today's logfiles in a text editor, type: <br/>
| + | 通过VI 或者其他linux 文本编辑器来查看文件,这里使用nano: <br/> |
| nano full <br/> | | nano full <br/> |
− | at the command prompt. This will open up the logfile in a text editor called "nano." <br/>
| |
− | 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.
| + | 查看文件,执行: <br/> |
− | 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: <br/>
| + | |
− | grep "is now" full > tempfile <br/>
| + | |
− | at the command prompt. <br/>
| + | |
− | | + | |
− | To view the file, type: <br/>
| + | |
| '''nano tempfile''' <br/> | | '''nano tempfile''' <br/> |
| | | |
− | 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. <br/>
| + | 完成以后,执行 CTRL-X 退出。<br/> |
− | When you're done in nano, hit CTRL-X to exit. <br/>
| + | 删除 temp 文件: <br/> |
− | You can delete the tempfile by typing: <br/>
| + | |
| '''rm tempfile''' <br/> | | '''rm tempfile''' <br/> |
− | You can also view the Asterisk log in real-time by entering the Asterisk Command Line Interface: <br/>
| + | 在linux 环境下,用户可以通过CLI 命令,查看实时日志: <br/> |
| '''asterisk -r''' <br/> | | '''asterisk -r''' <br/> |
− | To exit, type <br/>
| + | 退出,执行命令 '''exit''' <br/> |
− | '''exit''' <br/> | + | |
− | Alternatively, you can view the logfile in real-time using tail: <br/>
| + | 另外,用户也可以通过命令来查看log日志文件: <br/> |
| <pre> | | <pre> |
| cd /var/log/asterisk | | cd /var/log/asterisk |
| tail -f full | | tail -f full |
| <pre/> | | <pre/> |
− | When you're done, hit CTRL-C to exit.
| + | |
| + | 完成以后,执行CTRL-C 退出。 |