Skip to content

Commit b1cf04c

Browse files
committed
Merge branch 'master' into devel
2 parents 22a382d + 73f9bdd commit b1cf04c

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,47 @@ Many role variables can also take their values from environment variables as wel
120120

121121
- Enable configuration of rsyslogd or syslog-ng on Linux. If disabled, Consul will still log to syslog if `consul_syslog_enable` is true, but the syslog daemon won't be configured to write Consul logs to their own logfile.
122122
- Override with `CONSUL_CONFIGURE_SYSLOGD` environment variable
123-
- Default Linux value: *true*
123+
- Default Linux value: *false*
124124

125125
### `consul_log_path`
126-
127-
- Log path for use in rsyslogd configuration on Linux. Ignored if `consul_configure_syslogd` is false.
126+
- If `consul_syslog_enable` is false
127+
- Log path for use in [log_file or -log-file](https://www.consul.io/docs/agent/options.html#_log_file)
128+
- If `consul_syslog_enable` is true
129+
- Log path for use in rsyslogd configuration on Linux. Ignored if `consul_configure_syslogd` is false.
128130
- Default Linux value: `/var/log/consul`
129131
- Override with `CONSUL_LOG_PATH` environment variable
130132
- Default Windows value: `C:\ProgramData\consul\log`
131133

132134
### `consul_log_file`
133135

134-
- Log file for use in rsyslogd configuration on Linux. Ignored if `consul_configure_syslogd` is false.
135-
- Override with `CONSUL_LOG_FILE` environment variable
136+
- If `consul_syslog_enable` is false
137+
- Log file for use in [log_file or -log-file](https://www.consul.io/docs/agent/options.html#_log_file)
138+
- If `consul_syslog_enable` is true
139+
- Log file for use in rsyslogd configuration on Linux. Ignored if `consul_configure_syslogd` is false.
140+
- Override with `CONSUL_LOG_FILE` environment variable
136141
- Default Linux value: `consul.log`
137142

143+
### `consul_log_rotate_bytes`
144+
145+
- Log rotate bytes as defined in [log_rotate_bytes or -log-rotate-bytes](https://www.consul.io/docs/agent/options.html#_log_rotate_bytes)
146+
- Override with `CONSUL_LOG_ROTATE_BYTES` environment variable
147+
- Ignored if `consul_syslog_enable` is true
148+
- Default value: 0
149+
150+
### `consul_log_rotate_duration`
151+
152+
- Log rotate bytes as defined in [log_rotate_duration or -log-rotate-duration](https://www.consul.io/docs/agent/options.html#_log_rotate_duration)
153+
- Override with `CONSUL_LOG_ROTATE_DURATION` environment variable
154+
- Ignored if `consul_syslog_enable` is true
155+
- Default value: 24h
156+
157+
### `consul_log_rotate_max_files`
158+
159+
- Log rotate bytes as defined in [log_rotate_max_files or -log-rotate-max-files](https://www.consul.io/docs/agent/options.html#_log_rotate_max_files)
160+
- Override with `CONSUL_LOG_ROTATE_MAX_FILES` environment variable
161+
- Ignored if `consul_syslog_enable` is true
162+
- Default value: 0
163+
138164
### `consul_syslog_facility`
139165

140166
- Syslog facility as defined in [syslog_facility](https://www.consul.io/docs/agent/options.html#syslog_facility)
@@ -273,7 +299,7 @@ consul_node_meta:
273299

274300
- Log to syslog as defined in [enable_syslog or -syslog](https://www.consul.io/docs/agent/options.html#_syslog)
275301
- Override with `CONSUL_SYSLOG_ENABLE` environment variable
276-
- Default Linux value: true
302+
- Default Linux value: false
277303
- Default Windows value: false
278304

279305
### `consul_iface`

defaults/main.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ consul_systemd_limit_nofile: 65536
5656
syslog_user: "{{ lookup('env','SYSLOG_USER') | default('root', true) }}"
5757
syslog_group: "{{ lookup('env','SYSLOG_GROUP') | default('adm', true) }}"
5858
consul_log_level: "{{ lookup('env','CONSUL_LOG_LEVEL') | default('INFO', true) }}"
59-
consul_syslog_enable: "{{ lookup('env','CONSUL_SYSLOG_ENABLE') | default(true, true) }}"
59+
consul_log_rotate_bytes: "{{ lookup('env','CONSUL_LOG_ROTATE_BYTES') | default(0, true) }}"
60+
consul_log_rotate_duration: "{{ lookup('env','CONSUL_LOG_ROTATE_DURATION') | default('24h', true) }}"
61+
consul_log_rotate_max_files: "{{ lookup('env','CONSUL_LOG_ROTATE_MAX_FILES') | default(0, true) }}"
62+
consul_syslog_enable: "{{ lookup('env','CONSUL_SYSLOG_ENABLE') | default(false, true) }}"
6063
consul_syslog_facility: "{{ lookup('env','CONSUL_SYSLOG_FACILITY') | default('local0', true) }}"
61-
consul_configure_syslogd: "{{ lookup('env','CONSUL_CONFIGURE_SYSLOGD') | default(true, true) }}"
64+
consul_configure_syslogd: "{{ lookup('env','CONSUL_CONFIGURE_SYSLOGD') | default(false, true) }}"
6265

6366
### Consul settings
6467
consul_datacenter: "{{ lookup('env','CONSUL_DATACENTER') | default('dc1', true) }}"

templates/config.json.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@
5757
{## Agent ##}
5858
"data_dir": "{{ consul_data_path }}",
5959
"log_level": "{{ consul_log_level }}",
60+
{% if consul_syslog_enable | bool %}
6061
"enable_syslog": {{ consul_syslog_enable | bool | to_json }},
6162
"syslog_facility": "{{ consul_syslog_facility }}",
63+
{% else %}
64+
"log_file": "{{ consul_log_path }}/{{ consul_log_file }}",
65+
"log_rotate_bytes": {{ consul_log_rotate_bytes }},
66+
"log_rotate_duration": "{{ consul_log_rotate_duration }}",
67+
"log_rotate_max_files": {{ consul_log_rotate_max_files }},
68+
{% endif %}
6269
"disable_update_check": {{ consul_disable_update_check | bool | to_json }},
6370
"enable_script_checks": {{ consul_enable_script_checks | bool | to_json }},
6471
"enable_local_script_checks": {{ consul_enable_local_script_checks | bool | to_json }},

0 commit comments

Comments
 (0)