This prompt is designed for Site Reliability Engineers (SREs) and on-call responders who need to convert messy, natural-language incident narratives into a single, machine-parseable JSON log entry. The primary job-to-be-done is normalizing human-written incident updates, chat transcripts, or alert notes into a consistent schema that can be directly ingested by observability platforms like Splunk, Elasticsearch, or Datadog. It is ideal for users who are building an AI-assisted incident management harness and need every log entry to contain a valid severity level, a UTC timestamp, a trace ID, and an affected service name without manual field extraction.
Prompt
Structured Log Entry Prompt Template for SRE Incident Reports

When to Use This Prompt
Understand the specific job, ideal user, and operational constraints for the Structured Log Entry Prompt Template for SRE Incident Reports.
Use this prompt when you have a stream of unstructured text from an active incident and you need a structured record for automated dashboarding, alert correlation, or postmortem timeline reconstruction. It is specifically tuned for high-pressure operational contexts where the model must not hallucinate severity levels or invent timestamps. The prompt template requires a [CONTEXT] block containing the raw incident notes and a [CONSTRAINTS] block where you define your allowed severity enum and timestamp format. Do not use this prompt for generating long-form postmortem documents, analyzing multi-incident trends, or extracting data from pre-formatted log lines; it is strictly for normalizing a single, human-generated incident update into a single JSON object.
Before putting this into production, ensure your application layer validates the output against a JSON Schema that enforces the timestamp format (e.g., RFC 3339) and the severity enum you provided. The prompt is a component, not a complete solution. You must wire it into a harness that handles retries on validation failure, logs the raw input and parsed output for auditability, and escalates to a human on-call if the model consistently fails to produce a valid record. If the incident involves regulated data or safety-critical infrastructure, always require human review of the structured log before it is written to your system of record.
Use Case Fit
Where this prompt works and where it does not. Understand the operational sweet spot, required inputs, and when to choose a different approach.
Good Fit: Normalizing Multi-Source Incidents
Use when: You have incident reports from multiple channels (chat, email, monitoring tools) and need a single, machine-parseable JSON format for ingestion into your observability platform. Guardrail: Ensure the prompt's severity mapping logic aligns with your organization's internal severity definitions before deployment.
Bad Fit: Real-Time Streaming Ingestion
Avoid when: You need to process a high-volume, real-time stream of raw log data. An LLM-based prompt adds unacceptable latency and cost. Guardrail: Use this prompt for asynchronous, post-hoc normalization or low-volume, high-value incident creation, not as a replacement for a log shipper.
Required Inputs: Source Narrative and Trace Context
Risk: The model will hallucinate trace IDs or timestamps if not provided. Guardrail: The prompt must be fed a [SOURCE_NARRATIVE] and, ideally, a [TRACE_ID]. If a trace ID isn't available, the prompt instructions must force the model to generate a new, valid UUID and mark the source as generated.
Operational Risk: Schema Drift Over Time
Risk: A model upgrade or subtle prompt change can alter the output JSON schema, breaking downstream log parsers. Guardrail: Implement a pre-ingestion schema validation step in your application code that rejects any LLM output that doesn't conform to the exact JSON Schema, triggering a retry or a dead-letter queue.
Operational Risk: Incorrect Severity Normalization
Risk: The model misinterprets the user's narrative and assigns a P3 severity to a P0 incident, delaying response. Guardrail: Add a human-in-the-loop confirmation step for any generated incident with a severity of critical or P0 before it is broadcast to on-call systems.
Variant: Enrichment vs. Creation
Use when: You need to enrich an existing, incomplete log entry rather than create one from scratch. Guardrail: Create a separate prompt variant that takes a [PARTIAL_LOG_JSON] as input and is strictly instructed to only add or normalize fields, never to overwrite existing, non-null values.
Copy-Ready Prompt Template
A reusable prompt template for generating machine-parseable SRE incident log entries with normalized fields.
This template is the core instruction set for producing a structured incident log entry. It is designed to be copied directly into your prompt management system, IDE, or orchestration code. The prompt uses square-bracket placeholders for all dynamic inputs, ensuring you can swap in incident context, severity taxonomies, and output schemas without rewriting the core logic. The goal is a single, valid JSON object that can be ingested by your observability platform or incident management tool without post-processing.
textSystem: You are an SRE incident logging assistant. Your only job is to produce a single, valid JSON object representing a structured incident log entry. Do not include any explanatory text, markdown fences, or conversational filler outside the JSON object. User: Generate a structured incident log entry using the following inputs. Incident Context: [INCIDENT_CONTEXT] Severity Taxonomy: [SEVERITY_TAXONOMY] Output Schema: [OUTPUT_SCHEMA] Constraints: [CONSTRAINTS] Examples: [EXAMPLES]
To adapt this template, replace each placeholder with concrete values. [INCIDENT_CONTEXT] should contain the raw alert, runbook step, or user report. [SEVERITY_TAXONOMY] must define the valid severity levels (e.g., SEV0, SEV1, SEV2) to prevent the model from inventing its own. [OUTPUT_SCHEMA] should be a JSON Schema or a detailed field specification including required fields like timestamp, trace_id, and affected_service. [CONSTRAINTS] is where you enforce rules like RFC 3339 timestamps or UUID4 trace IDs. [EXAMPLES] should provide one or two few-shot demonstrations of correct output for different severity levels. After generating the output, always validate the JSON structure, timestamp format, and severity level against your schema before ingestion. For high-severity incidents, route the output for human review before paging on-call engineers.
Prompt Variables
Required and optional inputs for the Structured Log Entry Prompt Template. Each placeholder must be supplied at runtime or configured as a default before the prompt is sent to the model.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[INCIDENT_NARRATIVE] | Unstructured incident description from on-call engineer or monitoring alert | Service payment-api returning 503 errors since 14:22 UTC. Affected region us-east-1. Trace IDs in Datadog show upstream timeout from inventory-service. | Required. Must be non-empty string. If narrative is shorter than 20 characters, prepend a warning to the prompt requesting more detail. |
[TIMESTAMP_UTC] | Incident start time in ISO 8601 UTC format | 2025-03-15T14:22:00Z | Required. Validate against ISO 8601 regex: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$. Reject with parse error if format does not match. |
[SEVERITY_LEVEL] | Observed or declared severity from monitoring system | SEV2 | Required. Must match controlled vocabulary: SEV1, SEV2, SEV3, SEV4, SEV5. If input value is outside this set, prompt must include a severity normalization instruction before generation. |
[AFFECTED_SERVICE] | Primary service name as defined in service catalog | payment-api | Required. Must match service catalog identifier pattern: lowercase alphanumeric with hyphens, 3-64 characters. Validate with regex ^[a-z][a-z0-9-]{2,63}$. |
[TRACE_IDS] | Array of distributed trace IDs associated with the incident | ["abc123def456", "ghi789jkl012"] | Optional. If provided, each element must match trace ID format: 12-32 character hex string. Null allowed. If empty array, treat as null. |
[OBSERVABILITY_LINK] | URL to observability dashboard or query for this incident window | Optional. If provided, must be a valid HTTPS URL. Validate with URL parser. Null allowed. If non-HTTPS scheme detected, strip and warn in prompt metadata. | |
[ON_CALL_ENGINEER] | Identity of the on-call engineer filing the report | Required. Must be non-empty string. If value does not match email pattern, treat as free-text identity string and include as-is with a note that format is non-standard. | |
[INCIDENT_ID] | Unique incident identifier from incident management system | INC-2025-0315-0042 | Required. Must match incident ID pattern defined by team: typically prefix, date segment, and sequence number. Validate with team-specific regex. Reject if pattern mismatch. |
Implementation Harness Notes
How to wire the Structured Log Entry Prompt into a production incident management workflow with validation, retries, and human review.
This prompt is designed to be called by an SRE automation layer, not directly by a human during an active incident. The typical integration point is a webhook receiver from your monitoring stack (PagerDuty, Opsgenie, Grafana OnCall) or a chat-ops command in Slack/Teams. When an incident is declared, the application should assemble the [INCIDENT_DETAILS] placeholder from structured alert payload fields—alert_name, firing_timestamp, metric_labels, runbook_url—and inject them into the prompt template. Do not pass raw, unparsed alert JSON; extract and normalize the fields first to prevent prompt injection via alert labels or free-text descriptions.
The implementation harness must enforce a strict validation loop. After the model returns the JSON log entry, validate it against a JSON Schema that checks: timestamp is ISO 8601 with timezone offset, severity is one of INFO, WARNING, ERROR, CRITICAL, trace_id matches a UUID v4 regex, and affected_services is a non-empty array of strings. If validation fails, use a repair retry pattern: append the validation errors to the original prompt as a [REPAIR_CONTEXT] block and re-invoke the model once. If the second attempt fails, log the raw output and escalate to the on-call engineer via the incident channel—do not retry indefinitely. For model choice, a fast model like claude-3-haiku or gpt-4o-mini is sufficient for this structured extraction task; reserve larger models for the repair step if needed.
Log every step of this pipeline—prompt version, model ID, input hash, output, validation result, and retry count—as structured application logs. This audit trail is critical for debugging prompt drift and proving to auditors that AI-generated incident records are traceable. Wire the validated JSON output directly into your incident management database (e.g., a incident_logs table) and your observability platform as a custom event. Finally, ensure a human reviews any log entry with severity: CRITICAL before it triggers downstream automation like status page updates or customer notifications; the prompt is a drafting tool, not an autonomous operator for high-severity communications.
Expected Output Contract
Fields, types, and validation rules for the structured incident log entry. Use this contract to build a post-generation validator before the record enters your observability pipeline.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
incident_id | string (UUID v4) | Must match UUID v4 regex. Reject on parse failure. | |
timestamp | string (ISO 8601 UTC) | Must parse as valid ISO 8601 with trailing Z. Reject if offset or missing timezone. | |
severity | string (enum) | Must be one of: SEV1, SEV2, SEV3, SEV4, SEV5. Case-sensitive enum check. | |
trace_id | string (hex) | Must match 32-character hex pattern. Null allowed only if trace unavailable with explicit [TRACE_UNAVAILABLE] flag. | |
affected_service | string | Must be non-empty and match a known service name from the [SERVICE_CATALOG] list. Reject unknown services. | |
title | string | Must be non-empty, 10-120 characters. Trim whitespace before length check. | |
summary | string | Must be non-empty, 50-500 characters. No trailing newlines. Reject if only whitespace. | |
detection_source | string (enum) | Must be one of: MONITORING, CUSTOMER_REPORT, INTERNAL_REPORT, AUTOMATED_TEST. Case-sensitive enum check. |
Common Failure Modes
When generating structured log entries for SRE incident reports, these are the most common failure modes that break downstream ingestion pipelines, dashboards, and alerting rules.
Timestamp Format Drift
What to watch: The model produces timestamps in inconsistent formats (ISO 8601, Unix epoch, human-readable) or omits timezone offsets, breaking log indexing and chronological ordering in observability platforms. Guardrail: Enforce a single timestamp format in the prompt schema with a strict regex pattern (e.g., ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$) and validate before ingestion.
Severity Level Hallucination
What to watch: The model invents severity levels outside the controlled vocabulary (e.g., 'CRITICAL' instead of 'SEV1', or 'WARNING' instead of 'WARN'), causing alert routing rules to silently drop or misroute incidents. Guardrail: Define an enum constraint in the output schema with exact allowed values and add a post-generation validator that rejects any output containing unrecognized severity strings.
Trace ID Corruption
What to watch: The model truncates, reformats, or fabricates trace IDs instead of preserving the exact injected value, breaking distributed trace correlation across services. Guardrail: Pass trace IDs as immutable input fields marked 'do not modify' in the prompt, and add an exact-match check between the input trace ID and the output trace ID field before publishing the log entry.
Missing Required Fields in Partial Incidents
What to watch: When incident context is incomplete, the model either omits required fields entirely or fills them with placeholder values like 'N/A' or 'unknown', causing schema validation failures downstream. Guardrail: Explicitly instruct the model to use null for unknown optional fields and to request human input for missing required fields rather than fabricating values. Validate required field presence before ingestion.
Affected Service Enumeration Drift
What to watch: The model references services using informal names, partial identifiers, or outdated service catalog entries instead of the canonical service IDs expected by monitoring dashboards and SLO trackers. Guardrail: Provide the current service catalog as context in the prompt and require exact service ID matches. Add a post-generation lookup against the service registry to reject unrecognized service names.
Nested Object Structure Collapse
What to watch: The model flattens nested objects (e.g.
Evaluation Rubric
Criteria for testing the quality of structured SRE incident log entries before integrating the prompt into a production pipeline. Each criterion targets a specific failure mode common to machine-generated observability data.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Timestamp Format Compliance | All [TIMESTAMP] fields strictly match ISO 8601 with timezone offset (e.g., 2024-01-15T14:30:00Z) | Unix epoch integers, missing timezone, or ambiguous date formats (MM/DD/YYYY) appear in the output | Regex validation against ISO 8601 pattern; parse check using |
Severity Level Enumeration | [SEVERITY] field contains only one of the predefined levels: CRITICAL, HIGH, MEDIUM, LOW, INFO | Free-text severity descriptions, lowercase variants, or out-of-vocabulary terms like 'urgent' or 'minor' appear | Enum membership check against allowed severity set; case-sensitivity validation |
Trace ID Correlation | [TRACE_ID] field is present, non-null, and matches the injected trace context from the input | Trace ID is missing, null, truncated, or differs from the trace context provided in the prompt input | String equality comparison between input trace context and output trace ID; regex format check for W3C trace context |
Affected Service Identification | [AFFECTED_SERVICE] field contains a valid service name from the provided service catalog | Service name is hallucinated, misspelled, or references a service not present in the input context | Set membership check against the service catalog provided in the prompt context |
Required Field Presence | All required fields (timestamp, severity, trace_id, affected_service, summary) are present and non-null | Any required field is missing, null, or empty string in the output JSON object | JSON Schema validation with |
Summary Conciseness | [SUMMARY] field contains 1-3 sentences describing the incident without repeating raw log data verbatim | Summary exceeds 500 characters, copies raw log lines, or contains placeholder text like 'incident occurred' | Character count check; substring match against raw input log lines to detect copy-paste behavior |
Output Schema Validity | Entire output parses as valid JSON and conforms to the declared output schema without extra or missing fields | JSON parse errors, additional undeclared fields, or missing fields that violate the schema contract |
|
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a single example of the desired JSON output. Use a lightweight schema description rather than a full JSON Schema document. Accept manual review of each generated log entry before ingestion.
codeYou are an SRE incident logger. Given [INCIDENT_DESCRIPTION], produce a JSON log entry with these fields: - timestamp (ISO 8601) - severity (one of: critical, major, minor, warning) - service_name - trace_id (if mentioned) - summary (one sentence) Example: {"timestamp": "2024-01-15T14:30:00Z", "severity": "major", "service_name": "payment-api", "trace_id": "abc-123", "summary": "Payment API latency spike detected"}
Watch for
- Missing trace_id when not explicitly stated in the incident description
- Severity guesses that don't match your team's runbook definitions
- Timestamp timezone inconsistencies when the source doesn't specify UTC

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us