summaryrefslogtreecommitdiff
path: root/src/conf_mode/syslog.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-11-18 21:21:33 +0100
committerDaniil Baturin <daniil@baturin.org>2018-11-18 21:21:33 +0100
commitdcb207265472c2fed5fe13c1ba7091e5eea334a7 (patch)
tree8840e362818c5b0d6306ff5886ea3a05a4f088e0 /src/conf_mode/syslog.py
parenteee479a836b5699df8105a23107bbb056541c436 (diff)
parent7115030c32f8545e8a2e3f21723952110690d32f (diff)
downloadvyos-1x-dcb207265472c2fed5fe13c1ba7091e5eea334a7.tar.gz
vyos-1x-dcb207265472c2fed5fe13c1ba7091e5eea334a7.zip
Merge branch 'current' of https://github.com/vyos/vyos-1x into current
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]: