Inferensys

Prompt

Log Completeness Assessment Prompt for Failure Scenarios

A practical prompt playbook for using Log Completeness Assessment Prompt for Failure Scenarios in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Identify when a log completeness audit against injected failures is the right tool, and when it falls short.

This prompt is designed for platform engineers and SREs who need to validate that their services produce sufficient diagnostic signals during controlled failure scenarios. The core job-to-be-done is turning raw log output from a chaos experiment or fault injection into a structured completeness report. You should use this prompt when you have already executed a failure injection—such as killing a pod, severing a network link, or exhausting a connection pool—and captured the resulting logs from all affected services. The prompt assumes you possess both the raw log output and a known expected schema or a defined set of required fields (e.g., correlation IDs, request context, upstream/downstream identifiers). It is ideal for pre-production release gates, where you need evidence that your observability stack will support rapid incident diagnosis before real users are impacted.

Do not use this prompt as a substitute for real-time log anomaly detection, live tailing tools, or streaming alert evaluation. It is a point-in-time audit, not a continuous monitoring system. The prompt also does not replace a full distributed trace analysis; it focuses on the textual log content rather than span topology or timing. You should avoid using it when the failure scenario is undefined or when you lack an expected schema—without a clear contract for what 'complete' means, the model will produce a generic critique rather than a precise gap analysis. For high-risk production environments, always pair the output of this prompt with a human review step, especially when the completeness report flags missing correlation IDs or truncated stack traces that could mask a latent incident response blind spot.

Before running this prompt, ensure your input logs are sanitized of any production PII or secrets. The prompt template includes a [CONSTRAINTS] placeholder where you can inject redaction rules, but the safest path is to scrub data before it reaches the model. Once you receive the structured completeness report, use it to update your logging standards, instrumentation libraries, or runbook expectations. If the report identifies repeated gaps, consider automating the check as a CI/CD gate using the schema validation harness described in the implementation section. The next step after reading this introduction is to review the prompt template, adapt the placeholders to your specific failure scenario and expected schema, and run it against a known-good and known-bad log sample to calibrate your expectations.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Log Completeness Assessment Prompt delivers value and where it introduces risk. Use these cards to decide if this prompt fits your current failure scenario investigation.

01

Good Fit: Post-Incident Review

Use when: You are conducting a blameless post-incident review and need an objective, structured audit of log gaps during a known failure window. Guardrail: Feed the prompt a specific time range and service boundary to prevent scope creep and hallucinated events outside the evidence.

02

Bad Fit: Real-Time Anomaly Detection

Avoid when: You need sub-second detection of missing logs in a live production stream. This prompt is designed for batch analysis of a static log sample. Guardrail: Use a stream processor for detection; reserve this prompt for offline completeness audits and runbook improvement cycles.

03

Required Inputs

Risk: Garbage-in, garbage-out assessment if the prompt receives truncated logs or a non-representative sample. Guardrail: Ensure the input includes raw log lines with timestamps, the expected schema contract, and the failure injection context. Validate log sample integrity before calling the model.

04

Operational Risk: False Confidence

What to watch: The model may report a 'clean' completeness score if it fails to recognize a missing field that is critical to your specific debugging workflow. Guardrail: Always pair the model's output with a deterministic schema validator for required fields. Treat the model's assessment as a heuristic, not a source of truth.

05

Operational Risk: Sensitive Data Exposure

What to watch: Raw failure logs often contain PII, secrets, or internal IPs that should not leave your environment. Guardrail: Run a redaction pipeline before sending logs to the model. Use the PII Leakage Detection prompt sibling topic as a pre-flight check if you are unsure about the log content.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt that audits log output from a failure scenario and produces a structured completeness report.

This prompt is the core of the Log Completeness Assessment workflow. It is designed to be pasted directly into your AI harness, with square-bracket placeholders replaced by real values at runtime. The template instructs the model to act as a platform engineering auditor, systematically checking a provided log sample against a defined schema of required diagnostic fields. The output is a structured JSON report that your application can parse, store, and use to trigger automated quality gates or generate tickets for instrumentation gaps.

text
You are a platform engineering auditor. Your task is to analyze a log sample captured during a failure scenario and produce a structured completeness report.

## INPUT
Failure Scenario Description: [FAILURE_SCENARIO_DESCRIPTION]
Log Sample (plain text or JSON lines):

[LOG_SAMPLE]

code
Expected Service Topology (call path): [SERVICE_TOPOLOGY]

## OUTPUT SCHEMA
Return a single JSON object conforming to this structure:
{
  "assessment_id": "string",
  "overall_completeness_score": number (0-100),
  "critical_gaps": [
    {
      "gap_type": "missing_correlation_id" | "truncated_stack_trace" | "absent_request_context" | "missing_upstream_identifier" | "missing_downstream_identifier" | "missing_timestamp" | "missing_log_level" | "other",
      "severity": "critical" | "high" | "medium" | "low",
      "location": "string (line number or span ID)",
      "evidence": "string (excerpt from log showing the gap)",
      "recommendation": "string (actionable fix)"
    }
  ],
  "field_completeness": {
    "correlation_id_present": boolean,
    "request_context_present": boolean,
    "upstream_service_id_present": boolean,
    "downstream_service_id_present": boolean,
    "stack_trace_complete": boolean,
    "timestamp_iso8601": boolean,
    "log_level_present": boolean
  },
  "propagation_chain": [
    {
      "service_name": "string",
      "correlation_id_found": boolean,
      "span_id": "string or null"
    }
  ],
  "summary": "string (plain-language summary of findings)"
}

## CONSTRAINTS
- Only report a gap if you have direct evidence from the provided log sample. Do not speculate about missing data you cannot see.
- If a field is present but empty or null, mark it as absent.
- For the propagation chain, list every service in the expected topology and note whether a correlation ID was observed.
- The overall_completeness_score should reflect the proportion of required fields present and the severity of any critical gaps.
- If the log sample is unparseable or empty, return a valid JSON object with overall_completeness_score set to 0 and explain the parsing failure in the summary.

## RISK LEVEL
High. Incomplete logs during failure scenarios directly impact incident response time and diagnostic accuracy. Human review of this report is required before closing any associated incident or instrumentation task.

To adapt this template, replace the placeholders with real data from your test harness. [FAILURE_SCENARIO_DESCRIPTION] should be a brief, structured description of the injected failure, such as "Simulated network partition between service A and the inventory database." [LOG_SAMPLE] is the raw log output captured during that test, which can be a multiline string or a JSON-lines blob. [SERVICE_TOPOLOGY] must be a clear, ordered list of expected service hops for the request path under test, for example "api-gateway -> order-service -> payment-service -> notification-service." This topology is critical for the model to accurately populate the propagation_chain array and identify missing service identifiers. Before executing, ensure your harness validates that the model's output strictly conforms to the JSON schema; a failed parse should trigger a retry with a stronger format reminder.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the Log Completeness Assessment Prompt requires to produce a reliable gap report. Each variable must be populated before the prompt is sent; missing or malformed inputs are the most common cause of false-negative completeness scores.

PlaceholderPurposeExampleValidation Notes

[LOG_PAYLOAD]

The raw log lines or structured log entries to assess for completeness during a failure scenario.

{"timestamp":"2025-03-15T10:23:45Z","level":"ERROR","message":"Connection refused","service":"checkout"}

Must be a valid JSON array of objects or newline-delimited JSON. Reject if empty or if no timestamp field is detectable. Minimum 1 log entry required.

[FAILURE_SCENARIO]

A description of the injected or observed failure that generated the logs, providing context for what signals are expected.

Simulated network partition between checkout service and payment gateway for 120 seconds.

Must be a non-empty string. Reject if only whitespace. Should describe the fault, target service, and duration for accurate completeness scoring.

[EXPECTED_TOPOLOGY]

The expected service dependency graph or request path that should be reflected in the logs.

User -> API Gateway -> Checkout Service -> Payment Gateway -> External Bank API

Must be a non-empty string or structured list. Reject if null. A missing topology will cause the prompt to skip span-gap detection and return a low-confidence report.

[REQUIRED_FIELDS_SCHEMA]

A JSON Schema or field list defining the minimum required fields every log entry must contain.

["timestamp","level","message","service","correlationId","traceId"]

Must be a valid JSON array of strings. Reject if empty. If null, the prompt defaults to checking for correlationId, traceId, and service, but this reduces audit precision.

[CORRELATION_ID_KEY]

The exact field name used for the correlation ID in your log system.

correlationId

Must be a non-empty string matching a key in the log payload. Reject if null or mismatched. A wrong key causes false propagation-gap reports.

[SERVICE_IDENTIFIER_KEY]

The exact field name that identifies the emitting service in each log entry.

service

Must be a non-empty string matching a key in the log payload. Reject if null. If missing, the prompt cannot perform service-hop integrity checks.

[STACK_TRACE_FIELD_KEY]

The field name where stack traces are stored, if applicable. Used to detect truncation.

stackTrace

Can be null if stack traces are not expected. If provided, must be a string matching a key in the log payload. Null disables truncation checks.

[UPSTREAM_DOWNSTREAM_KEYS]

A list of field names that identify upstream and downstream service identifiers in the log context.

["upstreamService","downstreamService"]

Must be a JSON array of strings or null. If null, the prompt skips upstream/downstream identifier checks. Reject if not an array when provided.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the log completeness assessment prompt into an automated CI pipeline or manual audit workflow.

The log completeness assessment prompt is designed to be invoked programmatically after a chaos engineering experiment, a fault injection test, or a canary deployment that triggers known failure modes. The typical integration point is a post-test hook in your CI/CD pipeline (e.g., a GitHub Actions step, a Jenkins post-build stage, or a Tekton task) that collects structured log output from your observability backend (Splunk, Elastic, Loki) for the time window of the injected failure. The prompt expects a JSON payload containing the raw log lines, the expected topology of the request path, and a schema of required fields per service. You should wrap the model call in a thin service that handles authentication, rate limiting, and response parsing.

Before sending the prompt, validate the input payload against a strict schema: ensure log_lines is a non-empty array of objects, expected_topology includes a valid service dependency graph, and required_fields maps each service to its mandatory log attributes (e.g., correlation_id, trace_id, upstream_service, downstream_service). On the output side, parse the model's JSON response and validate it against the expected completeness report schema. If the model returns malformed JSON, implement a retry loop with a repair prompt that includes the raw output and the schema definition. Log every model call—input payload, raw response, parsed report, and validation errors—to an audit table for traceability. For high-risk production audits, route reports with a completeness_score below a configurable threshold (e.g., 0.8) to a human reviewer via a Slack notification or a Jira ticket.

Model choice matters here. Use a model with strong JSON mode and long-context handling, such as Claude 3.5 Sonnet or GPT-4o, because log payloads can be large and the output schema is deeply nested. If you're processing high volumes, consider batching log windows and running assessments in parallel, but be mindful of rate limits and token costs. Avoid using this prompt as a real-time gate on critical path requests—it's an offline audit tool, not a live validation step. The next step after implementation is to build a dashboard that tracks completeness scores over time per service, so teams can see whether their logging discipline is improving or degrading with each release.

IMPLEMENTATION TABLE

Expected Output Contract

Schema contract for the log completeness assessment output. Use this to validate the model response before ingesting it into an automated gap detection pipeline or dashboard.

Field or ElementType or FormatRequiredValidation Rule

assessment_id

string (UUID v4)

Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

timestamp

string (ISO 8601 UTC)

Must parse as valid datetime; must be within 5 minutes of request time

failure_scenario

object

Must contain 'scenario_id' (string) and 'injection_point' (string); no additional properties allowed

completeness_score

number (0.0-1.0)

Must be float between 0 and 1 inclusive; two decimal places

gaps

array of gap objects

Each gap must have 'severity' (enum: CRITICAL, HIGH, MEDIUM, LOW), 'category' (enum: MISSING_CORRELATION_ID, TRUNCATED_STACK_TRACE, ABSENT_REQUEST_CONTEXT, MISSING_UPSTREAM_ID, MISSING_DOWNSTREAM_ID, OTHER), 'field_path' (string), 'evidence' (string, non-empty), 'recommendation' (string, non-empty)

correlation_id_propagation

object

Must contain 'present' (boolean), 'service_hops' (array of strings), 'break_detected_at' (string or null); null allowed only if present is true

stack_trace_integrity

object

Must contain 'is_truncated' (boolean), 'truncation_point' (string or null), 'missing_frames_estimate' (integer >= 0); null allowed for truncation_point only if is_truncated is false

request_context_completeness

object

Must contain 'method' (boolean), 'url_path' (boolean), 'user_agent' (boolean), 'client_ip' (boolean), 'request_body_snippet' (boolean); all fields required boolean

PRACTICAL GUARDRAILS

Common Failure Modes

When auditing log completeness during failure scenarios, these are the most common ways the prompt breaks and how to prevent them.

01

Hallucinated Correlation IDs

What to watch: The model invents plausible-looking correlation IDs or trace IDs that don't exist in the actual log input, making gap reports misleading. Guardrail: Require the model to quote the exact ID string from the source log line or explicitly mark it as NOT_FOUND. Add a post-processing check that flags any ID not present in the input.

02

False Negative Gap Detection

What to watch: The model overlooks missing context fields (e.g., absent user_id or tenant_id) because the log line is otherwise well-formed, producing a completeness score that's too optimistic. Guardrail: Provide an explicit required-fields schema in the prompt and instruct the model to check every field independently. Use a checklist output format so omissions are visible.

03

Truncated Stack Trace Misinterpretation

What to watch: The model treats a truncated or partial stack trace as complete, missing the fact that root-cause frames were cut off by a log length limit. Guardrail: Instruct the model to look for truncation markers (e.g., ..., <omitted>, or abrupt endings) and flag them. Add a specific check for whether the deepest frame is a framework boundary or an actual root cause.

04

Service Boundary Confusion

What to watch: The model cannot distinguish between upstream and downstream service identifiers, misattributing missing spans to the wrong service or direction. Guardrail: Provide a service topology map or expected hop list as part of the input context. Require the model to label each gap with the specific service and direction (inbound/outbound) where the log is missing.

05

Log Level Blindness

What to watch: The model assesses completeness only on structured fields and ignores whether the log level itself is appropriate—e.g., an ERROR logged as DEBUG that would be missed by alerting. Guardrail: Add a log-level appropriateness check to the output schema. Require the model to compare the severity of the event against the level used and flag mismatches.

06

Context Window Overflow on Large Logs

What to watch: When analyzing long failure traces, the model loses early log lines from context, causing it to miss the initial error or request entry point. Guardrail: Chunk the log input by request or trace ID before sending to the model. If chunking isn't possible, instruct the model to explicitly state which time range it analyzed and flag any gaps due to truncation.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing the Log Completeness Assessment Prompt before integrating it into a CI pipeline or incident review workflow. Use these checks to validate that the prompt reliably identifies missing diagnostic context in failure-scenario logs.

CriterionPass StandardFailure SignalTest Method

Missing Correlation ID Detection

Prompt correctly flags log entries missing [CORRELATION_ID] with a severity of HIGH

Prompt reports no gaps when correlation IDs are absent from 50% of log lines

Inject a log sample with a known missing correlation ID and verify the gap appears in the output

Truncated Stack Trace Identification

Prompt identifies stack traces ending in '... N more' or similar truncation markers and reports line count

Prompt treats a truncated stack trace as complete or fails to note the truncation indicator

Provide a log containing a deliberately truncated Java stack trace and check for the truncation flag in the report

Absent Request Context Flagging

Prompt reports missing fields like [REQUEST_METHOD], [REQUEST_PATH], or [USER_ID] when required by the schema

Prompt accepts a log line with only a timestamp and message as contextually complete

Submit a minimal log line with no request context and confirm the output lists the missing required fields

Upstream/Downstream Service Identifier Gap

Prompt detects when a log entry references an external call but omits [UPSTREAM_SERVICE] or [DOWNSTREAM_SERVICE]

Prompt only checks for service identifiers in explicitly labeled service-call log lines

Use a log line containing an HTTP 502 from an unnamed dependency and verify the gap is reported

Schema Conformance Validation

Output JSON strictly matches the [OUTPUT_SCHEMA] with all required fields present and correctly typed

Output is missing the 'gap_type' enum, 'severity' field, or 'evidence' array

Validate the raw model output against the expected JSON Schema using a programmatic validator

False Positive Rate on Healthy Logs

Prompt returns an empty gaps array for a log sample that meets all completeness requirements

Prompt invents gaps such as 'missing correlation ID' when the field is present in every line

Feed a fully compliant, well-formed log sample and assert that the gaps array length is zero

Severity Classification Accuracy

Prompt assigns HIGH severity only to gaps that block incident diagnosis; MEDIUM to informational gaps

Prompt marks a missing optional metadata field as HIGH severity

Provide a log with a missing optional field like [BUILD_VERSION] and assert the severity is MEDIUM or LOW

Multi-Line Exception Handling

Prompt correctly associates a multi-line exception stack with the originating request and does not report each line as a separate gap

Prompt treats each line of a stack trace as an independent log entry and reports phantom gaps

Inject a 20-line Python traceback and verify the output contains one gap entry for the exception, not twenty

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single log sample and lighter validation. Drop the strict JSON schema requirement and ask for a free-text completeness assessment first. Replace the full [LOG_SCHEMA] with a short checklist of 3-5 must-have fields (correlation ID, timestamp, service name, error code, stack trace).

code
Analyze this log entry from a failure scenario and check for these required fields:
- correlation_id
- timestamp
- service_name
- error_code
- stack_trace

Log: [LOG_ENTRY]

Watch for

  • Missing schema checks leading to inconsistent output format
  • Overly broad instructions that produce vague "looks good" responses
  • No distinction between missing fields and empty-but-present fields
Prasad Kumkar

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.