net-mgmt/zabbix-agent: add syslog option (#2348)

* zabbix_agentd.conf: handle enableSyslog condition

zabbix_agentd.conf: Write 'system' for logging to syslog or 'file' (plus file options) for logging to file

* ZabbixAgent.xml: add syslogEnable option

* settings.xml: describe option for enabling syslog
This commit is contained in:
Bradlee H. Edmondson
2021-07-11 14:32:02 +02:00
committed by GitHub
parent 70497698e0
commit 2a5bb93007
3 changed files with 19 additions and 1 deletions
@@ -41,6 +41,13 @@
<allownew>true</allownew>
<help><![CDATA[List of IP addresses (or hostnames) of Zabbix servers. Incoming connections will be accepted only from the hosts listed here.]]></help>
</field>
<field>
<id>zabbixagent.settings.main.syslogEnable</id>
<label>Log to syslog</label>
<type>text</type>
<help><![CDATA[Use syslog, instead of logging to file.]]></help>
<advanced>true</advanced>
</field>
<field>
<id>zabbixagent.settings.main.logFileSize</id>
<label>Log File Size</label>
@@ -45,6 +45,10 @@
<mask>/^.{1,255}$/u</mask>
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
</sourceIP>
<syslogEnable type="BooleanField">
<default>0</default>
<Required>N</Required>
</syslogEnable>
<logFileSize type="IntegerField">
<default>100</default>
<MinimumValue>1</MinimumValue>
@@ -7,10 +7,17 @@
############ GENERAL PARAMETERS #################
PidFile=/var/run/zabbix/zabbix_agentd.pid
{% if helpers.exists('OPNsense.ZabbixAgent.settings.main.syslogEnable') and OPNsense.ZabbixAgent.settings.main.syslogEnable|default('0') == '1' %}
LogType=system
{% else %}
LogType=file
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize={{OPNsense.ZabbixAgent.settings.main.logFileSize}}
{% endif %}
DebugLevel={{OPNsense.ZabbixAgent.settings.main.debugLevel|replace("val_", "")}}
{% if helpers.exists('OPNsense.ZabbixAgent.settings.main.sourceIP') %}