Often, especially when analyzing production logs, you might be interested in questions like "how many users were active in the last hour?" or "how many active connections in the past hour for each of my servers during high load?". It's nice when you know this up-front and instrumented Prometheus accordingly, but often these questions are retrospective.
Then you may be tempted to just use some `awk '{print $1 " " $15}' | sort -u | cut -d" " -f1 | uniq -c ` to back out unique IPs per server over the last hour for a rough estimate.
By using sketches, we can scale this solution to cases where the number of log lines would make `sort` fail due to OOM or take forever. Here, you'd run `dsrs --key`.
1 comment
[ 2.3 ms ] story [ 11.4 ms ] threadIf your log lines look like
Then you may be tempted to just use some `awk '{print $1 " " $15}' | sort -u | cut -d" " -f1 | uniq -c ` to back out unique IPs per server over the last hour for a rough estimate.By using sketches, we can scale this solution to cases where the number of log lines would make `sort` fail due to OOM or take forever. Here, you'd run `dsrs --key`.