summaryrefslogtreecommitdiff
path: root/src/conf_mode/syslog.py
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2018-11-14 16:24:27 -0800
committerhagbard <vyosdev@derith.de>2018-11-14 16:24:27 -0800
commit439d86aa55c7eed9619391ecec04bc1fbd5f9323 (patch)
tree7e3e055a59f703403f2295c0aa18cb77821ee201 /src/conf_mode/syslog.py
parent93c9199589cca87321f1f0577d16099dbe78842b (diff)
downloadvyos-1x-439d86aa55c7eed9619391ecec04bc1fbd5f9323.tar.gz
vyos-1x-439d86aa55c7eed9619391ecec04bc1fbd5f9323.zip
Fixes: T940 adding immark to syslog options
Diffstat (limited to 'src/conf_mode/syslog.py')
-rwxr-xr-xsrc/conf_mode/syslog.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/conf_mode/syslog.py b/src/conf_mode/syslog.py
index f652cf3d0..f8f8d9457 100755
--- a/src/conf_mode/syslog.py
+++ b/src/conf_mode/syslog.py
@@ -30,6 +30,12 @@ from vyos import ConfigError
configs = '''
## generated by syslog.py ##
## file based logging
+{% if files['global']['marker'] %}
+$ModLoad immark
+{% if files['global']['marker-interval'] %}
+$MarkMessagePeriod {{files['global']['marker-interval']}}
+{% endif %}
+{% endif %}
{% for file in files %}
$outchannel {{file}},{{files[file]['log-file']}},{{files[file]['max-size']}},{{files[file]['action-on-max-size']}}
{{files[file]['selectors']}} :omfile:${{file}}
@@ -80,10 +86,10 @@ def get_config():
c.set_level('system syslog')
config_data = {
- 'files' : {},
+ 'files' : {},
'console' : {},
- 'hosts' : {},
- 'user' : {}
+ 'hosts' : {},
+ 'user' : {}
}
#####
@@ -102,13 +108,16 @@ def get_config():
}
)
+ if c.exists('global marker'):
+ config_data['files']['global']['marker'] = True
+ if c.exists('global marker interval'):
+ config_data['files']['global']['marker-interval'] = c.return_value('global marker interval')
if c.exists('global facility'):
config_data['files']['global']['selectors'] = generate_selectors(c, 'global facility')
if c.exists('global archive size'):
config_data['files']['global']['max-size'] = int(c.return_value('global archive size'))* 1024
if c.exists('global archive files'):
config_data['files']['global']['max-files'] = c.return_value('global archive files')
-
###
# set system syslog file
###
@@ -217,14 +226,12 @@ def generate_selectors(c, config_node):
def generate(c):
tmpl = jinja2.Template(configs, trim_blocks=True)
config_text = tmpl.render(c)
- #print (config_text)
with open('/etc/rsyslog.d/vyos-rsyslog.conf', 'w') as f:
f.write(config_text)
## eventually write for each file its own logrotate file, since size is defined it shouldn't matter
tmpl = jinja2.Template(logrotate_configs, trim_blocks=True)
config_text = tmpl.render(c)
- #print (config_text)
with open('/etc/logrotate.d/vyos-rsyslog', 'w') as f:
f.write(config_text)
@@ -247,6 +254,7 @@ def verify(c):
fac = ['*','auth','authpriv','cron','daemon','kern','lpr','mail','mark','news','protocols','security',\
'syslog','user','uucp','local0','local1','local2','local3','local4','local5','local6','local7']
lvl = ['emerg','alert','crit','err','warning','notice','info','debug','*']
+
for conf in c:
if c[conf]:
for item in c[conf]: