Simplify logmark used in syslog

Instead of using `date | md5sum` and parsing the output to get the
actual md5sum (without the stdin filename), use the current unixtime
with a `logmark-` prefix.
This commit is contained in:
Christian Boltz 2022-02-21 22:52:14 +01:00
parent c0734411ee
commit 95d89dfbac
Failed to generate hash of commit

View file

@ -18,6 +18,7 @@ import os
import re
import subprocess
import sys
import time
import apparmor.aa as apparmor
import apparmor.ui as aaui
@ -140,9 +141,7 @@ if os.path.exists('/var/log/audit/audit.log'):
while not done_profiling:
if syslog:
logmark = subprocess.check_output(['date | md5sum'], shell=True)
logmark = logmark.decode('ascii').strip()
logmark = re.search('^([0-9a-f]+)', logmark).groups()[0]
logmark = 'logmark-%s' % str(int(time.time())) # unix timestamp, seconds only
t=subprocess.call([apparmor.logger_path(), '-p', 'kern.warn', 'GenProf: %s'%logmark])
else: