Skip to main content

Log Analysis & Debugging Assistant

Analyze application logs to find the root cause of errors, performance issues, and anomalies, with a structured investigation method and fix recommendations.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt makes the AI an expert at log analysis that works backward from symptoms to root cause. You describe the [problem_description], the [timeline] of when it started, paste your [log_data], and give the [tech_stack] and [recent_changes], and it performs a six-step investigation: log pattern analysis, ranked root-cause hypotheses, diagnostic commands, missing-information gaps, a fix recommendation, and logging improvement suggestions. It is structured to find the first error in a sequence, not the loudest most recent one.

The structure works because it imposes incident discipline. It categorizes each entry by level, builds a timeline of events leading to failure, and flags unusual frequency spikes and correlated events. It then presents the top three hypotheses ranked by likelihood with supporting evidence and a confidence percentage, and gives concrete diagnostic commands to confirm or rule out each one (the example commands use your [condition] and [command] placeholders). The fix section separates immediate mitigation from the proper fix and prevention, and [log_format] guides the logging improvements left behind.

When to use it

  • A production incident is live and the logs are too noisy to read by eye
  • You keep fixing the most recent error instead of the actual root cause
  • You want ranked hypotheses with evidence rather than one confident guess
  • You need diagnostic commands to confirm or rule out each theory
  • You want immediate mitigation separated from the durable fix
  • You want concrete logging improvements so the next incident is faster to debug

Example output

You get a categorized log breakdown with a failure timeline, three ranked root-cause hypotheses each with supporting log evidence and a confidence percentage, per-hypothesis diagnostic commands, a list of missing data that would narrow things down, a three-part fix (mitigation, root-cause fix, prevention), and specific structured-logging improvements for the affected code paths.

Pro tips

  • Paste real [log_data]; the analysis is only as good as the lines you give it, so include the window around the failure
  • Be precise in [timeline], since "started at 14:30, no deploy since" rules out whole classes of cause
  • Always fill [recent_changes] honestly; a deploy 18 hours earlier is a prime suspect even if it feels unrelated
  • Set [tech_stack] accurately so the diagnostic commands target your real services
  • Use [log_format] to match your stack (structured JSON via Monolog) so improvement suggestions are actionable
  • Run the diagnostic commands to confirm a hypothesis before applying its fix; confidence percentages are estimates, not proof

Frequently Asked Questions

How does it find the root cause instead of the obvious error?
It explicitly identifies the first error in the sequence rather than the most recent one, builds a timeline of events leading to the failure, and flags correlated events. This avoids the common trap of fixing a downstream symptom while the real cause keeps firing.
Do I need to paste my actual logs?
Yes. You paste your real entries into the `[log_data]` variable, and the quality of the analysis depends directly on them. Include the window of time around the failure, not just the final error line, so the timeline is complete.
Does it give me commands to confirm the diagnosis?
Yes. For each of the top three hypotheses it provides specific diagnostic commands to confirm or rule it out. You should run those commands before applying a fix, since the confidence percentages are estimates rather than proof.
Will it help me prevent the issue from recurring?
The fix recommendation separates immediate mitigation from the proper root-cause fix and a prevention plan covering monitoring, tests, and guardrails. It also suggests structured-logging improvements so the next incident is faster to diagnose.
Why does it ask for recent changes?
The `[recent_changes]` variable gives the analysis a prime suspect list. A deployment or config change shortly before the issue, even one that seems unrelated, is frequently the cause, so providing it sharpens the hypotheses considerably.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in DevOps & Cloud Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support