Streaming Log Metrics to Datadog StatsD with Python

I wanted log observability without paying for log retention. Datadog's free tier includes StatsD ingestion, so I wrote a script that uses a generator to tail the log file, parses out what I care about, and ships metrics without retaining anything. The example here counts response status codes from nginx access logs. Finding the Log File Docker writes container logs to a JSON file on the host. The…