diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LogController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LogController.php
index e29b2cd64..1bd7e364d 100644
--- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LogController.php
+++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LogController.php
@@ -40,31 +40,40 @@ class LogController extends ApiControllerBase
{
public function __call($name, $arguments)
{
+ $module = substr($name, 0, strlen($name)-6);
+ $scope = count($arguments) > 0 ? $arguments[0] : "";
+ $action = count($arguments) > 1 ? $arguments[1] : "";
if ($this->request->isPost() && substr($name, -6) == 'Action') {
$this->sessionClose();
- // create filter to sanitize input data
- $filter = new Filter();
- $filter->add('query', new QueryFilter());
-
- // fetch query parameters (limit results to prevent out of memory issues)
- $itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
- $currentPage = $this->request->getPost('current', 'int', 1);
-
- if ($this->request->getPost('searchPhrase', 'string', '') != "") {
- $searchPhrase = $filter->sanitize($this->request->getPost('searchPhrase'), "query");
- } else {
- $searchPhrase = '';
- }
-
$backend = new Backend();
- $response = $backend->configdpRun("system diag log", array($itemsPerPage,
- ($currentPage-1)*$itemsPerPage, $searchPhrase, substr($name,0, strlen($name)-6)));
- $result = json_decode($response, true);
- if ($result != null) {
- $result['rowCount'] = count($result['rows']);
- $result['total'] = $result['total_rows'];
- $result['current'] = (int)$currentPage;
- return $result;
+ if ($action == "clear") {
+ $backend->configdpRun("system clear log", array($module, $scope));
+ return ["status" => "ok"];
+ } else {
+ // create filter to sanitize input data
+ $filter = new Filter();
+ $filter->add('query', new QueryFilter());
+
+ // fetch query parameters (limit results to prevent out of memory issues)
+ $itemsPerPage = $this->request->getPost('rowCount', 'int', 9999);
+ $currentPage = $this->request->getPost('current', 'int', 1);
+
+ if ($this->request->getPost('searchPhrase', 'string', '') != "") {
+ $searchPhrase = $filter->sanitize($this->request->getPost('searchPhrase'), "query");
+ } else {
+ $searchPhrase = '';
+ }
+
+ $response = $backend->configdpRun("system diag log", array($itemsPerPage,
+ ($currentPage-1)*$itemsPerPage, $searchPhrase, $module, $scope)
+ );
+ $result = json_decode($response, true);
+ if ($result != null) {
+ $result['rowCount'] = count($result['rows']);
+ $result['total'] = $result['total_rows'];
+ $result['current'] = (int)$currentPage;
+ return $result;
+ }
}
}
return array();
diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/LogController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/LogController.php
index be4167dd5..b1a277601 100644
--- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/LogController.php
+++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/LogController.php
@@ -37,16 +37,19 @@ use OPNsense\Base\IndexController;
*/
class LogController extends IndexController
{
- public function indexAction($scope)
+ public function renderPage($module, $scope)
{
$this->view->pick('OPNsense/Diagnostics/log');
+ $this->view->module = $module;
$this->view->scope = $scope;
}
public function __call($name, $arguments)
{
if (substr($name, -6) == 'Action') {
- return $this->indexAction(substr($name,0, strlen($name)-6));
+ $scope = count($arguments) > 0 ? $arguments[0] : "core";
+ $module = substr($name,0, strlen($name)-6);
+ return $this->renderPage($module, $scope);
}
}
}
diff --git a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/log.volt b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/log.volt
index ce7161ae8..650798b03 100644
--- a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/log.volt
+++ b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/log.volt
@@ -29,7 +29,36 @@ POSSIBILITY OF SUCH DAMAGE.
@@ -41,6 +70,7 @@ POSSIBILITY OF SUCH DAMAGE.
@@ -49,6 +79,17 @@ POSSIBILITY OF SUCH DAMAGE.
#
+ {{ lang._('Date') }}
{{ lang._('Line') }}
| + + | +