📄 logs.php
字号:
<?php/* Copyright (C) 2005 Earl C. Terwilliger Email contact: earl@micpc.com Name : logs.php Usage: PHP script to provide a selection form to list system and Asterisk logs This file is part of The Asterisk WEB/PHP Management Interface. These files are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. These programs are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with these files (see COPYING); if not, write to the: Free Software Foundation, Inc. 59 Temple Place Suite 330 Boston, MA 02111-1307 USA*/if (isset($_POST['radio'])) { if ($_POST['radio'] == "cdrformat") { if (isset($_POST['pattern'])) $pattern = $_POST['pattern']; header("Location: cdr.php?pattern=$pattern");// header("Location: http://$_SERVER/asterisk/cdr.php?pattern=$pattern"); }}include('header.php');include('files.php');include('functions.php');if (isset($_POST['submit'])) { $submit = $_POST['submit']; if (isset($_POST['loglines'])) $loglines = $_POST['loglines']; else $loglines = 0; if (isset($_POST['pattern'])) $pattern = $_POST['pattern']; else $pattern = ""; if (isset($_POST['radio'])) $radio = $_POST['radio']; if ($submit =="SUBMIT") { if ($pattern != "") $cmd = "/bin/grep $pattern "; else { if ($loglines == 0) $cmd = "/bin/cat "; else $cmd = "/usr/bin/tail -$loglines "; } if ($radio == "syslog") $cmd .= $SYSTEMMESSAGES; if ($radio == "cdr") $cmd .= $CDRMASTER; if ($radio == "events") $cmd .= $ASTEVENTLOG; if ($radio == "messages") $cmd .= $ASTMESSAGESLOG; if ($radio == "queue") $cmd .= $ASTQUEUELOG; echo "<pre>"; mysystem($cmd); echo "</pre>"; echo "<br>"; echo $cmd; echo "<br>"; echo "Done !"; }}else{?> <div align=center> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table> <tr><td> Search String <input type=text name="pattern" value="" length=20> </td><td> Lines to List [0=All] <input type=text name="loglines" value=50 length=3> </td></tr> </table> <table> <tr><td> <input type="radio" name="radio" value="events"> Asterisk Event Log </td><td> </td></tr> <tr><td> <input type="radio" name="radio" value="messages"> Asterisk Message Log </td><td> </td></tr> <tr><td> <input type="radio" name="radio" value="queue"> Asterisk Queue Log </td><td> </td></tr> <tr><td> <input type="radio" name="radio" value="cdr"> Asterisk CDR Log </td><td> </td></tr> <tr><td> <input type="radio" name="radio" value="cdrformat"> Asterisk CDR Log [Table Formatted] </td><td> </td></tr> <tr><td> <input type="radio" name="radio" value="syslog" checked> System Log [SYSLOG] </td><td> </td></tr> </table> <br> <input type="submit" name="submit" value="SUBMIT"></input> <input type="reset" name="reset" value="RESET"></input> </form> </div><?php}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -