c/devops › command
0votes

Set up structured logging and alerts

Prompt
submitted by CommandVault editors to c/devops

Logs you can search and alerts that only fire when it matters.

Prompt · 1 variable
Set up structured logging and alerting for a {{stack}} service.

1. A logger setup that outputs JSON with timestamp, level, request id, user id (hashed) and duration.
2. Rules for what to log at each level, and what never to log (tokens, passwords, full card numbers, raw PII).
3. Middleware that attaches a request id and logs one line per request.
4. Five alerts worth having for this service, each with a threshold, window and why it matters.
5. How to avoid alert fatigue: grouping, severity and who gets paged.

Show code for the logger and middleware.
0 commentsreport

Try it here

Fill in {{stack}} above first for a better answer, or run it as is and the AI will assume sensible values.

or open in ChatGPT · Claude · Perplexity

How to use this prompt

  1. Fill in the blank above. The more specific you are, the better the answer.
  2. Copy it and paste it into ChatGPT, Claude, Gemini, Cursor or Codex, or use "Try it here" for a quick test.
  3. Read the answer critically: check anything it claims about your code or data before you rely on it.
  4. Careful: this one is marked medium risk. Review what the AI suggests before you run it on real systems or data.
  • {{stack}} Stack

More from c/devops

See all of c/devops →
0 comments

Log in to join the discussion.