fork download
  1. def mapper():
  2. log_pattern = re.compile(r'^(\S+) - - \[(\d{2})/(\w{3})/(\d{4}):(\d{2}):\d{2}:\d{2} .*\]')
  3.  
  4. for line in sys.stdin:
  5. match = log_pattern.match(line)
  6. if match:
  7. ip = match.group(1)
  8. hour = match.group(5) # Extract hour from timestamp
  9. print(f"{hour}\t{ip}")
Success #stdin #stdout 0.09s 14104KB
stdin
Standard input is empty
stdout
Standard output is empty