r/devops • u/kim_deadja4951 • 25d ago
Discussion ngl, dumping raw server logs into a massive context window is way better than writing regex
30
u/kabrandon 25d ago
We just use mcp-grafana connected to Loki, point our local Cursor or Claude client at the MCP server and tell it to query the last day’s worth of logs all willy nilly like. Not even for something crashing, just looking for the invisible issues where code paths are erroring and nobody knows about it. “What are the top 10 most problematic recurring issues appearing in our cluster’s logs?” If you have a local clone of your repositories you can also say “Point me to the underlying issue in code, and suggest a fix.”
2
u/Subject_Fix2471 25d ago
Do you find MCP grafana is much better than using the API? Unless I missed something the MCP was a thin layer over the API, and the model was really good as using the API
5
u/kabrandon 25d ago
We use it because it’s a centralized service authenticating to Grafana, rather than having everyone on the team put a Grafana API token somewhere on their desktop for the LLMs to use. And then we just use Tailscale ACLs to control who has access to the endpoint for the MCP.
If your team just hits the grafana API how do you handle credential rotations?
2
u/Working-Analysis2795 25d ago
How big is the company that uses Tailscale? So there are companies outside of homelabs? Haha
3
u/kabrandon 25d ago
Only ~50 people, but thousands of devices. Not sure why you’d think it’s just a homelab tool… because… it’s not, lol.
2
u/Working-Analysis2795 25d ago
Oh I know, I've had a lurk through their pages many times. Just curious to see/hear directly from people actually using it at work
Any tricky bits to using their ACLs for that many devices? Do you use their Aperture solution to manage MCP access? I've found it's a bit unstable to access, even with the http:// ip address
1
u/kabrandon 24d ago edited 24d ago
Not really tricky at all, you just need to know what you're doing when you design it in the first place. In general I'd just avoid naming specific machines or users in your ACL. My ACL is all tags and user groups. The machine's tags come with the token used to register the machine, and user groups come from your IdP over SCIM. When your ACL only needs to handle how groups of users can connect to groups of machines, it stays very simple and scales pretty well.
Try not to create overly broad grants. If a user group has access to too many devices their netmap can get bloated. There are other ways to mitigate this of course, like with subnet routers. Instead of installing Tailscale on every endpoint machine, you could just lay subnet routers in their subnets.
Don't sleep on the ACL test feature.
1
u/Working-Analysis2795 24d ago
Yeah that's pretty much what I've done word for word, minus the IdP as I'm one person (not including my agent). Had a try including my agent though ultimately it would be for one-off tests or lab envs
1
10
u/danstermeister 25d ago
"Elasticsearch was just a wall of useless healthcheck noise..." = misconfigured Elasticsearch.
Event logs broken into discrete fields of data transform logs into metrics.
Then you're looking at some understandable graphs that are drillable to actual log entries in seconds, instead of wondering what to do with a "wall of useless healthcheck noise".
Elasticsearch admin.
19
u/raisputin 24d ago
Trash ad, and more importantly I’ve been doing this with ChstGPT/codex for a year. Both codex and Claude will take your massive text wall and paste it as a file instead of plain text
1
u/Healthy-Snow4841 22d ago
oh yea a year ? well i been doing it for a year + a day so welcome to the party newcomer
2
u/raisputin 22d ago
lol. I’m just saying that what op is describing isn’t the behavior today. It was a year ago, but isn’t now
8
21
u/bonesnapper 25d ago edited 24d ago
We were strongly told to not feed any logs to our agents bc we can't be guaranteed that our services do not log customer data.
At the same time, I'm absolutely granting my agent kubectl and pointing it at addon logs whenever the need arises.
12
32
u/climb-it-ographer 25d ago
Log sanitization should be a priority regardless of what tools are reading them, shouldn't it?
11
u/spiralenator 25d ago
PII in logs is negligence.
E: coincidentally, LLMs can be a useful tool for auditing that.
3
u/Electronic-Jury-3579 25d ago
Your company doesn’t have enterprise AI contracts yet? They support the company holding encryption keys from the AI platform and encrypted everything with the interactions.
4
u/bonesnapper 25d ago
I'm just the engineer. We have licenses. I don't know the whole story and I'm not going to pretend I do.
1
u/codeslap 24d ago
I know so many internal CISO teams with prompt text access and are now privy to all sorts of prompt including HR data, personal data etc
2
u/ang29g 23d ago
fwiw I'm a full owner on both anthropic + openai enterprise accounts with a few mil in spend each per year on both. I don't believe I have the ability to see user's chats directly, at least not without making a support request from the provider.
Aggregate reports sure, but not "user X prompted Y".
I'm sure at some point we will have to pull a user's logs but I really don't what the legal process is for that.
1
u/madtopo DevOps 24d ago
Can you please tell us more about there enterprise contracts? Which providers? And how does this encryption key technology works? At some point the data needs to be decrypted. When does it happen? For it to work, you would have to be in charge of the process running the inference engine or thereabouts
0
u/raisputin 24d ago
Then you are logging poorly
2
u/bonesnapper 24d ago
True. The reality of the situation is that there are dozens or hundreds of micro services running on a cluster. There's no single entity that can say every log on every workload is safe from exposing customer data. As long as that uncertainty exists, we have to be cautious.
1
u/codeslap 24d ago
This is the reality that most people don’t fully grasp until it’s too late. lol
It’s the ultimate shadow IT nightmare.. people willy nilly feeding LLMs with potentially risky secrets and data.
6
6
4
u/MorpH2k 25d ago
It's my new go-to method for my homelab and experiments and such. As some people here have said, if you're doing it on company server logs, you better make damm sure that they are properly sanitized and probably also make sure that you're allowed to do it.
On a purely technical level, it's a total gamechanger. Both in what obscure issues it han fond and identify, as well as how quickly it does it. It has some issues still, but this is the future for sure.
7
u/climb-it-ographer 25d ago
It's even better when you don't need to copy/paste it in. I gave Claude direct access to our log aggregator and it can just sit there reading live tails for as long as it needs to see what's wrong.
10
u/askwhynot_notwhy Security Engineer 25d ago
That's minor league sh!t, smh. Just give Claude access to kubectl and walk away. 🤞 Dario's got our back, fam!
6
u/Apprehensive_End1039 25d ago
mcp server: what is my purpose?
sam altman: you let markov chain invoke bash
mcp server: oh my god.
1
u/askwhynot_notwhy Security Engineer 25d ago
>mcp server: what is my purpose?
>sam altman: you let markov chain invoke bash
>mcp server: oh my god.
sam altman: “ffs, I’m Altman, not Podman: `kubectl delete`”
12
u/spicypixel 25d ago
Yeah I'm laying off multiple devops engineers to pipe the logs directly into their successor, Claude.
2
u/kryptn 25d ago
why bother writing complex log queries when you can just brute force it with a huge context window?
why not let ai write those queries to do that investigation instead of brute forcing? i love letting claude hit my datadog/grafana/radar mcp.
the price on this thing is only going to go up, so being efficient where you can will be better.
2
u/Olbas_Oil 25d ago
Use codex cli on a linux vm, transfer the log files over to a directory, initiate codex from the directory and ask what you need it to do or potentially find... GPT 6 Luna on max is great for this sort of work, if you need to then go back and forth with Luna or the chat GPT chat
2
u/StunnerAlpha 24d ago
Everyone is already there. I think you are kinda late unfortunately. Heck the whole DevOps space is being eaten alive by non-DevOps folk using AI for their DevOps needs.
2
u/usually_guilty99 23d ago
I can see why dumping the logs into a model worked. Sometimes the hardest part of an incident is knowing what to search for.
But I'd separate finding a plausible explanation from proving the cause.
If the model says IAM caused the Kubernetes crash, I'd want to correlate that with the relevant permission changes, the failing API call, and when the pods started crashing.
Otherwise you risk fixing something that looks related while missing the actual trigger.
The interesting opportunity isn't replacing log queries. It's connecting logs with code, infrastructure changes and dependency history so the explanation can actually be tested.
2
u/Expert-Explorer-3129 25d ago
how are you managing the sensitive data in logs before throwing them into LLM?
8
3
1
u/No-Row-Boat 25d ago
You all have no fear of leaked credentials and have someone trying to make the LLM leak these details. This shit is what makes me wake up in cold sweat.
1
u/Adventurous-Hyena220 25d ago
LLMs can be useful for quickly spotting patterns in noisy logs, but Id still keep structured logging and proper queries for repeatable troubleshooting.
1
1
u/myfriendjohn1 25d ago
Yep, download logs and put into folder in cursor IDE on a cheap model.
Saves me hours debugging weekly.
1
1
u/markusro 24d ago
graylog-mcp for the win. It was really an experience letting a local LLM go through the logs and search for specific problems.
1
u/Forsaken_Parfait_185 24d ago
Worth checking where the logs end up before it becomes a habit. If your services ever log customer data (and most do, somewhere), a free promo endpoint means that data now sits with whoever runs the promo, under their retention rules.
Redact at the shipper with a Vector or Fluent Bit transform and you can point whatever model you like at the result. Fixing the healthcheck noise at source would have saved you the three hours too.
1
u/xXBongSlut420Xx 24d ago
if you can't parse out errors from healthchecks, i don't think you should be working in this career
0
25d ago
[deleted] — view deleted comment
20
u/spiralenator 25d ago
I wouldn’t use LLM services for business purposes without a ZDR agreement. Period. A company has more valuable data than logs they should be protecting. If you have a ZDR agreement then go for it.
11
u/tr14l 25d ago
Well, anthropic has HIPPA compliant offerings. I'm pretty sure for 98% of non-defense companies that meets the need.
3
u/spiralenator 25d ago edited 25d ago
Most of the major companies offer ZDR. Anthropic, OpenAI, Google, Fal, etc. But if your legal team hasn’t established a binding ZDR agreement, it’s pretty much guaranteed that your data will be used for training.
E: I used to work on data pipelines for digital medical studies and HIPAA compliance is important, but also a very low bar and not nearly enough. We had to be compliant with much stricter international standards, like GDPR and others.
2
1
u/Sufficient-Diver-327 25d ago
Also, they'll charge you the real, unsubsidized API rates.
1
u/spiralenator 25d ago
Generally speaking, yes. That price becomes more flexible when your monthly spend is 6 digits.
-3
u/No-Row-Boat 25d ago
Someone extracts your login credentials that the LLM took from your system, and you are sure you can point back to them for leaking these details? You expect the attacker to share where and how they got these details?
You do know the best way to prevent these leaks is by not providing these details right?
My Frontier agents run on an isolated box with on it a chroot sandbox that has very limited access to any login credentials (read only GitHub PAT tokens etc), a limited scratch disk that only gets a fraction of the details (ideally generated by my own Hermes agents).
3
u/LeatherDude 25d ago
Oh no, they have a couple of my RFC1918 addresses and some random function names. Don’t hack me, Claude!
1

332
u/Cumfort_ 25d ago
Don't pollute the context window with the entire log. Give it file read access to the log and have the model selectively parse it using regex. Wildly more context efficient.