Python – Tail & Ship Logs to HTTP
Tail a log file and send entries to an HTTP endpoint.
#!/usr/bin/env python3
import requests, time, sys
url = sys.argv[1]; path = sys.argv[2]
with open(path) as f:
f.seek(0,2)
while True:
line = f.readline()
if not line:
time.sleep(0.5); continue
requests.post(url, data={'line': line})
From Joseph Nakhle's automation workbench.
More Other tools scripts