assertPermission('audit/log'); if ($this->Config()->get('log', 'type') !== 'file') { $this->httpNotFound('Page not found'); } $this->getTabs()->add('audit/log', [ 'active' => true, 'label' => $this->translate('Audit Log'), 'url' => 'audit/log', ]); $file = $this->Config()->get('log', 'path', '/var/log/icingaweb2/audit.log'); if (! @file_exists($file)) { $this->render('log-empty'); return; } $resource = new FileReader(new ConfigObject([ 'filename' => $file, 'fields' => '/(?[0-9]{4}(?:-[0-9]{2}){2}' // date . 'T[0-9]{2}(?::[0-9]{2}){2}(?:[\+\-][0-9]{2}:[0-9]{2})?)' // time . ' - (?.+)' // identity . ' - (?.+)' // type . ' - (?.+)' // message . '(?!.)/msSU' // $ can't handle multilines, don't ... ])); $this->view->logData = $resource->select()->order('DESC'); $this->setupLimitControl(); $this->setupPaginationControl($this->view->logData); } }