diff --git a/CHANGELOG.md b/CHANGELOG.md index fbcd7fe..31da6a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ * **tasks** with fusioninventory__agent_conf_tasks variable * **logger** with fusioninventory__agent_conf_log_logger variable * **logfacility** with fusioninventory__agent_conf_log_facility variable + * **logfile** with fusioninventory__agent_conf_log_file variable + * **logfile-maxsize** with fusioninventory__agent_conf_log_file_maxsize variable ## v1.3.1 diff --git a/README.md b/README.md index 2a591f4..bb1824f 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ Some variables used to generate FusionInventery agent.cfg file from Ansible temp * **fusioninventory__agent_conf_httpd_trust** : hostname or IP or subnet authorized for http request [default⎵: ``]. * **fusioninventory__agent_conf_log_logger** : Specifies the logger backend to use [default⎵: `syslog`]. * **fusioninventory__agent_conf_log_facility** : Specifies the syslog facility to use for the syslog logger backend [default⎵: `LOG_DAEMON`]. +* **fusioninventory__agent_conf_log_file** : Specifies the file to use for the file logger backend [default⎵: `/var/log/fusioninventory.log`]. +* **fusioninventory__agent_conf_log_file_maxsize** : Specifies the maximum size for the log file, in MB [default⎵: `0`]. * **fusioninventory__agent_conf_tag** : Add given tag to inventory results [default⎵: ``]. * **fusioninventory__agent_conf_debug** : If debug mode should be enabled [default⎵: `False`]. diff --git a/defaults/main.yml b/defaults/main.yml index fb614d5..bbbf308 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -238,6 +238,25 @@ fusioninventory__agent_conf_log_logger: 'syslog' # fusioninventory__agent_conf_log_facility: 'LOG_DAEMON' # ]]] +# .. envvar:: fusioninventory__agent_conf_log_file: [[[ +# +# Specifies the file to use for the file logger backend. +# +# ``/var/log/fusioninventory.log`` +# Default. +# +fusioninventory__agent_conf_log_file: '/var/log/fusioninventory.log' + # ]]] +# .. envvar:: fusioninventory__agent_conf_log_file_maxsize: [[[ +# +# Specifies the maximum size for the log file, in MB. +# When the max size is reached, the file is truncated. +# +# ``0`` +# Default. 0 means unlimited size. +# +fusioninventory__agent_conf_log_file_maxsize: '0' + # ]]] # .. envvar:: fusioninventory__agent_conf_tag [[[ # # Add given tag to inventory results diff --git a/templates/etc/fusioninventory/agent.cfg.j2 b/templates/etc/fusioninventory/agent.cfg.j2 index 5a9950e..c590852 100644 --- a/templates/etc/fusioninventory/agent.cfg.j2 +++ b/templates/etc/fusioninventory/agent.cfg.j2 @@ -133,10 +133,12 @@ httpd-trust = {{ fusioninventory__agent_conf_httpd_trust }} # Logger backend, either Stderr, File or Syslog (Stderr) logger = {{ fusioninventory__agent_conf_log_logger }} +{% if fusioninventory__agent_conf_log_logger == 'file' %} # log file -#logfile = /var/log/fusioninventory.log +logfile = {{ fusioninventory__agent_conf_log_file }} # maximum log file size, in MB -#logfile-maxsize = 0 +logfile-maxsize = {{ fusioninventory__agent_conf_log_file_maxsize }} +{% endif %} {% if fusioninventory__agent_conf_log_logger == 'syslog' %} # Syslog facility logfacility = {{ fusioninventory__agent_conf_log_facility }}