-def find_tapdisk_logs():
- return glob.glob('/var/log/blktap/*.log*')
-
-def generate_tapdisk_logs():
- for pid in pidof('tapdisk'):
- try:
- os.kill(pid, SIGUSR1)
- output_ts("Including logs for tapdisk process %d" % pid)
- except :
- pass
- # give processes a second to write their logs
- time.sleep(1)
-
-def clean_tapdisk_logs():
- for filename in find_tapdisk_logs():
- try:
- os.remove(filename)
- except :
- pass
-
-def filter_db_pii(str, state):
- if 'in_secret_table' not in state:
- state['in_secret_table'] = False
-
- if str.startswith('<table ') and 'name="secret"' in str:
- state['in_secret_table'] = True
- elif str.startswith('</table>'):
- state['in_secret_table'] = False
-
- if state['in_secret_table'] and str.startswith("<row"): # match only on DB rows
- str = re.sub(r'(value=")[^"]+(")', r'\1REMOVED\2', str)
- return str
-