diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:13:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:13:17 +0000 |
commit | 968a206dff4631e1ecc8a489f7884d08648113aa (patch) | |
tree | 48747500fe157b459d74fac87e7114e6c846d215 /application/forms | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-audit-968a206dff4631e1ecc8a489f7884d08648113aa.tar.xz icingaweb2-module-audit-968a206dff4631e1ecc8a489f7884d08648113aa.zip |
Adding upstream version 1.0.2.upstream/1.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/forms')
-rw-r--r-- | application/forms/Config/AuditLogConfigForm.php | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/application/forms/Config/AuditLogConfigForm.php b/application/forms/Config/AuditLogConfigForm.php new file mode 100644 index 0000000..6e93b5a --- /dev/null +++ b/application/forms/Config/AuditLogConfigForm.php @@ -0,0 +1,93 @@ +<?php + +/* Icinga Web 2 | (c) 2018 Icinga Development Team | GPLv2+ */ + +namespace Icinga\Module\Audit\Forms\Config; + +use Icinga\Forms\ConfigForm; + +class AuditLogConfigForm extends ConfigForm +{ + public function createElements(array $formData) + { + $this->addElement( + 'select', + 'log_type', + [ + 'autosubmit' => true, + 'label' => $this->translate('Standard Log'), + 'description' => $this->translate('Human-readable message log'), + 'multiOptions' => [ + 'none' => $this->translate('None', 'log.type'), + 'file' => $this->translate('File'), + 'syslog' => 'Syslog' + ] + ] + ); + if (isset($formData['log_type']) && $formData['log_type'] === 'file') { + $this->addElement( + 'text', + 'log_path', + [ + 'label' => $this->translate('Standard Log Path'), + 'description' => $this->translate('The full path to the standard log'), + 'placeholder' => '/var/log/icingaweb2/audit.log' + ] + ); + } elseif (isset($formData['log_type']) && $formData['log_type'] === 'syslog') { + $this->addElement( + 'text', + 'log_ident', + [ + 'label' => $this->translate('Ident'), + 'description' => $this->translate('The identifier to use for syslog messages'), + 'placeholder' => 'icingaweb2-audit' + ] + ); + $this->addElement( + 'select', + 'log_facility', + [ + 'label' => $this->translate('Facility'), + 'description' => $this->translate('The facility to send syslog messages to'), + 'multiOptions' => [ + '' => 'auth', // The default + 'authpriv' => 'authpriv', + 'user' => 'user', + 'local0' => 'local0', + 'local1' => 'local1', + 'local2' => 'local2', + 'local3' => 'local3', + 'local4' => 'local4', + 'local5' => 'local5', + 'local6' => 'local6', + 'local7' => 'local7' + ] + ] + ); + } + + $this->addElement( + 'checkbox', + 'stream_format', + [ + 'autosubmit' => true, + 'label' => $this->translate('JSON Log'), + 'description' => $this->translate('Machine-parsable JSON objects'), + 'checkedValue' => 'json', + 'uncheckedValue' => 'none' + ] + ); + if (isset($formData['stream_format']) && $formData['stream_format'] === 'json') { + $this->addElement( + 'text', + 'stream_path', + [ + 'label' => $this->translate('JSON Log Path'), + 'description' => $this->translate('The full path to the JSON log'), + 'placeholder' => '/var/log/icingaweb2/audit.json' + ] + ); + } + } +} |