mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-07-21 19:23:32 +03:00
Allow viewing of past logs.
Add a command-line PHP script for rotation in cron.
This commit is contained in:
parent
56c1789b30
commit
f081d96b0c
4 changed files with 88 additions and 9 deletions
15
logs.php
15
logs.php
|
@ -24,10 +24,21 @@ switch ($_GET['action']) {
|
|||
|
||||
case "list":
|
||||
global $logging;
|
||||
if ($logging !== TRUE)
|
||||
if ($logging !== TRUE) {
|
||||
jtable_respond(null, 'error', 'Logging is disabled');
|
||||
break;
|
||||
}
|
||||
|
||||
$entries=getlogs();
|
||||
if(!empty($_POST['logfile'])) {
|
||||
if(preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}\.json/',$_POST['logfile']) == 1) {
|
||||
$entries=json_decode(file_get_contents($logsdirectory . "/" . $_POST['logfile']),true);
|
||||
} else {
|
||||
jtable_respond(null, 'error', "Can't find log file");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$entries=getlogs();
|
||||
}
|
||||
|
||||
if(!empty($_POST['user'])) {
|
||||
$entries=array_filter($entries,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue