Skip to content
Snippets Groups Projects
Verified Commit 686dde76 authored by anarcat's avatar anarcat
Browse files

tool to audit gitlab logs for team#41470

parent 7a694704
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python3
import fileinput
import json
import logging
def main():
logging.basicConfig(level="INFO")
try:
for line in fileinput.input(openhook=fileinput.hook_compressed):
if fileinput.isfirstline():
logging.info("parsing %s", fileinput.filename())
try:
blob = json.loads(line)
except ValueError as e:
logging.warning("failed to parse %s:%d: %s", fileinput.filename(), fileinput.lineno(), e)
continue
for param in blob.get('params', []):
try:
email = param.get('value', {}).get('email')
except AttributeError:
logging.debug("ignoring string value: %s", param.get('value'))
continue
if email:
logging.info("email: %r", email)
except OSError as e:
logging.error("error while processing file %s at line %s: %s, skipping", fileinput.filename(), fileinput.lineno(), e)
fileinput.nextfile()
if __name__ == '__main__':
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment