Add posibility to configure salt logging params:
- LOG_FILE
- LOG_LEVEL
- LOG_LEVEL_LOGFILE
Change-Id: Ic8c0c3bb2a4a80ba0590ca79d8e491dd4f840897
diff --git a/README.rst b/README.rst
index bcf6493..de8b4a6 100644
--- a/README.rst
+++ b/README.rst
@@ -139,6 +139,30 @@
address: https://git.openstack.org/openstack/salt-formula-keystone
revision: refs/changes/56/123456/1
+Salt master logging configuration
+
+.. code-block:: yaml
+
+ salt:
+ master:
+ enabled: true
+ log:
+ level: warning
+ file: '/var/log/salt/master'
+ level_logfile: warning
+
+Salt minion logging configuration
+
+.. code-block:: yaml
+
+ salt:
+ minion:
+ enabled: true
+ log:
+ level: info
+ file: '/var/log/salt/minion'
+ level_logfile: warning
+
Salt master with logging handlers
.. code-block:: yaml
diff --git a/salt/files/master.conf b/salt/files/master.conf
index 9f9b00a..bbfff60 100644
--- a/salt/files/master.conf
+++ b/salt/files/master.conf
@@ -151,6 +151,22 @@
{%- endif %}
{%- endif %}
+{%- if master.log is defined %}
+
+{%- if master.log.level is defined %}
+log_level: {{ master.log.level }}
+{%- endif %}
+
+{%- if master.log.file is defined %}
+log_file: {{ master.log.file }}
+{%- endif %}
+
+{%- if master.log.level_logfile is defined %}
+log_level_logfile: {{ master.log.level_logfile }}
+{%- endif %}
+
+{%- endif %}
+
{%- if pillar.salt.get('minion') %}
{%- for handler in pillar.salt.minion.get("handlers", []) %}
{%- if handler.engine == "udp"%}
diff --git a/salt/files/minion.conf b/salt/files/minion.conf
index 1743fda..c3a8e68 100644
--- a/salt/files/minion.conf
+++ b/salt/files/minion.conf
@@ -66,8 +66,23 @@
{%- endif %}
-log_level: {{ minion.log.get('level', 'error') }}
-state_output: {{ minion.log.get('state_output', 'changes') }}
+{%- if minion.log is defined %}
+
+{%- if minion.log.level is defined %}
+log_level: {{ minion.log.level }}
+{%- endif %}
+
+{%- if minion.log.file is defined %}
+log_file: {{ minion.log.file }}
+{%- endif %}
+
+{%- if minion.log.level_logfile is defined %}
+log_level_logfile: {{ minion.log.level_logfile }}
+{%- endif %}
+
+{%- endif %}
+
+state_output: {{ minion.get('log', {}).get('state_output', 'changes') }}
{%- if minion.get('proxy', {}).get('host', "") != "" %}
proxy_host: {{ minion.proxy.host }}
diff --git a/tests/pillar/master_logging.sls b/tests/pillar/master_logging.sls
new file mode 100644
index 0000000..32e62ed
--- /dev/null
+++ b/tests/pillar/master_logging.sls
@@ -0,0 +1,24 @@
+git:
+ client:
+ enabled: true
+linux:
+ system:
+ enabled: true
+salt:
+ master:
+ command_timeout: 5
+ worker_threads: 2
+ enabled: true
+ source:
+ engine: pkg
+ pillar:
+ engine: salt
+ source:
+ engine: local
+ environment:
+ prd:
+ formula: {}
+ log:
+ level: warning
+ file: '/var/log/salt/master'
+ level_logfile: warning
diff --git a/tests/pillar/minion_logging.sls b/tests/pillar/minion_logging.sls
new file mode 100644
index 0000000..c5f678b
--- /dev/null
+++ b/tests/pillar/minion_logging.sls
@@ -0,0 +1,9 @@
+salt:
+ minion:
+ enabled: true
+ master:
+ host: config01.dc01.domain.com
+ log:
+ level: info
+ file: '/var/log/salt/minion'
+ level_logfile: warning