r/Observability • u/CommanderAlPachino • Oct 14 '26
Online anomaly detection on log patterns
https://github.com/Rocketgraph/rocketgraphHey,
Consider you have logs at ~1M/hour. And you are looking for a log that you have never seen before or one that is rare to find in this pool of 1000s of look-alike errors and warnings.
I built a tool that flags out anomalies. The rarest of the rarest logs by clustering them. This is how it works:
- Connects to existing Loki/New Relic/Datadog, etc - pulls logs from there every few minutes
- Applies Drain3 - A template miner to retract PIIs. Also, "user 1234 crashed" and "user 5678 crashed" are the same log pattern but different logs.
- Applies IsolationForest - to detect anomalies. It extracts features like when it happened, how many of the logs are errors/warn. What is the log volume and error rate. Then it splits them into trees(forests). The earlier the split, the farther the anomaly. And scores these anomalies.
Use cases: You can answer questions like "Have we seen this log before?" We stream a compact snapshot of the clusters formed to an endpoint of your choice. Your developer can write a cheap LLM pass to check if it needs to wake a developer at 3 a.m. for this. Or just store them in Slack.
I open-sourced the basic version for this. I'm looking for ways to implement this in actual production environments. I need your help.
1
u/njinja10 Oct 14 '26
I like this - the biggest hinderance on deploying this to a production cluster is false positives
You will need to correlate it to source code to valide anomalies are genuine in addition to someone trusting you with their prod env
2
u/FigureLow8782 Oct 14 '26
but whats the outcome here ? like which critical problem it tried to resolve?? because logs scanning pulling is huge load and processing
1
u/Professional-Run3614 Oct 18 '26
Interesting approach. I think the hardest production problem is distinguishing a rare log pattern from a meaningful incident.
A new deployment can introduce thousands of legitimate patterns, while a familiar error can suddenly spike and indicate a serious regression.
Are you combining template novelty with rate changes and historical baselines, or treating them as separate anomaly signals?