diff options
author | hagbard <vyosdev@derith.de> | 2018-11-14 16:24:27 -0800 |
---|---|---|
committer | hagbard <vyosdev@derith.de> | 2018-11-14 16:26:09 -0800 |
commit | 67875d1c308176209fc5cb41bd43bf73ddd16a67 (patch) | |
tree | 89f7790a9c69b7e6388b0e75b307f12879eaf535 /src | |
parent | 567fac5959c81fff274fbaa07cd527ad46749ed7 (diff) | |
download | vyos-1x-67875d1c308176209fc5cb41bd43bf73ddd16a67.tar.gz vyos-1x-67875d1c308176209fc5cb41bd43bf73ddd16a67.zip |
Fixes: T940 adding immark to syslog options
(cherry-picked 439d86aa55c7eed9619391ecec04bc1fbd5f9323)
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/syslog.py | 20 |
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]: |