Skip to content

Commit

Permalink
Strip dirname of program name only if path is absolute
Browse files Browse the repository at this point in the history
* Some daemons (like postfix) add prefix to program names.
  Ex: postfix/smtpd. This prefix must not be removed.
* If the path is absolute (start with a /) we can remove dirname
  to only keep program name
  • Loading branch information
JrCs committed Aug 17, 2016
1 parent e2cf32c commit 3cb8d06
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chaperone/cutil/syslog.py
Expand Up @@ -280,7 +280,8 @@ def parse_to_output(self, msg):
else:
logattrs = match.groupdict()
pri = int(logattrs['pri'])
logattrs['tag'] = os.path.basename(logattrs['tag'])
if logattrs['tag'][0] == '/':
logattrs['tag'] = os.path.basename(logattrs['tag'])

logattrs['raw'] = msg

Expand Down

0 comments on commit 3cb8d06

Please sign in to comment.