Implement "start" filter, small fixes
+Remove occasionally added 'kern.log' include filter +Fix debug log crash during logs collection
This commit is contained in:
parent
f8ec70ff20
commit
02b0d9851a
@ -16,7 +16,6 @@ timeout: 15
|
||||
compress_timeout: 3600
|
||||
logs:
|
||||
path: '/var/log'
|
||||
include: 'kern.log'
|
||||
exclude: '[-_]\d{8}$|atop[-_]|\.gz$'
|
||||
# by_role:
|
||||
# compute:
|
||||
@ -34,4 +33,4 @@ logs:
|
||||
# - 'IPTABLES_STR="iptables -S"'
|
||||
# logs:
|
||||
# path: '/var/log'
|
||||
# include: 'messages'
|
||||
# start: '2016-05-04 22:00'
|
||||
|
@ -226,7 +226,12 @@ class Node(object):
|
||||
def logs_populate(self, timeout=5):
|
||||
self.got_logs = False
|
||||
for item in self.logs:
|
||||
cmd = ("find '%s' -type f -exec du -b {} +" % item['path'])
|
||||
if 'start' in item:
|
||||
start = ' -newermt \\"$(date -d \'%s\')\\"' % item['start']
|
||||
else:
|
||||
start = ''
|
||||
cmd = ("find '%s' -type f%s -exec du -b {} +" % (item['path'],
|
||||
start))
|
||||
logging.info('logs_populate: node: %s, logs du-cmd: %s' %
|
||||
(self.node_id, cmd))
|
||||
outs, errs, code = tools.ssh_node(ip=self.ip,
|
||||
@ -242,11 +247,11 @@ class Node(object):
|
||||
if len(outs):
|
||||
self.got_logs = True
|
||||
item['files'] = {}
|
||||
for line in outs.split('\n'):
|
||||
if '\t' in line:
|
||||
size, filename = line.split('\t')
|
||||
item['files'][filename] = int(size)
|
||||
logging.debug('logs_populate: logs: %s' % (item['files']))
|
||||
for line in outs.split('\n'):
|
||||
if '\t' in line:
|
||||
size, filename = line.split('\t')
|
||||
item['files'][filename] = int(size)
|
||||
logging.debug('logs_populate: logs: %s' % (item['files']))
|
||||
return self
|
||||
|
||||
def logs_dict(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user