diff --git a/src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/ServiceController.php b/src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/ServiceController.php
index c6ec78b56..7f5cf3b37 100644
--- a/src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/ServiceController.php
+++ b/src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/ServiceController.php
@@ -311,4 +311,24 @@ class ServiceController extends ApiControllerBase
return array();
}
}
+
+ /**
+ * drop alert log
+ * @return array status
+ */
+ public function dropAlertLogAction()
+ {
+ if ($this->request->isPost()) {
+ // close session for long running action
+ $this->sessionClose();
+ $backend = new Backend();
+ $filename = $this->request->getPost('filename', 'string', null);
+ if ($filename != null) {
+ $filename = basename($filename);
+ $backend->configdpRun("ids drop alertlog", array($filename));
+ return array("status" => "ok");
+ }
+ }
+ return array("status" => "failed");
+ }
}
diff --git a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
index 5fc7dd4b2..f6e455db9 100644
--- a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
+++ b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
@@ -69,9 +69,9 @@ POSSIBILITY OF SUCH DAMAGE.
$('#alert-logfile').html("");
$.each(data, function(key, value) {
if (value['sequence'] == undefined) {
- $('#alert-logfile').append($("").attr("value",'none').text(value['modified']));
+ $('#alert-logfile').append($("").data('filename', value['filename']).attr("value",'none').text(value['modified']));
} else {
- $('#alert-logfile').append($("").attr("value",value['sequence']).text(value['modified']));
+ $('#alert-logfile').append($("").data('filename', value['filename']).attr("value",value['sequence']).text(value['modified']));
}
});
$('.selectpicker').selectpicker('refresh');
@@ -427,6 +427,34 @@ POSSIBILITY OF SUCH DAMAGE.
history.pushState(null, null, e.target.hash);
});
+ // delete selected alert log
+ $("#actDeleteLog").click(function(){
+ var selected_log = $("#alert-logfile > option:selected");
+ BootstrapDialog.show({
+ type:BootstrapDialog.TYPE_DANGER,
+ title: '{{ lang._('Remove log file ') }} ' + selected_log.html(),
+ message: '{{ lang._('Removing this file will cleanup disk space, but cannot be undone.') }}',
+ buttons: [{
+ icon: 'fa fa-trash-o',
+ label: '{{ lang._('Yes') }}',
+ cssClass: 'btn-primary',
+ action: function(dlg){
+ ajaxCall(url="/api/ids/service/dropAlertLog/",sendData={filename: selected_log.data('filename')},
+ callback=function(data,status){
+ updateAlertLogs();
+ });
+ dlg.close();
+ }
+ }, {
+ label: 'Close',
+ action: function(dlg){
+ dlg.close();
+ }
+ }]
+ });
+
+ });
+
});
@@ -568,6 +596,7 @@ POSSIBILITY OF SUCH DAMAGE.
+