Inferensys

Prompt

Anomaly Timeline Reconstruction Prompt

A practical prompt playbook for using the Anomaly Timeline Reconstruction Prompt to build chronological narratives from scattered log events in production security and incident response workflows.
Incident responder handling AI system issue on laptop, logs and alerts visible, late night on-call session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the operational context, ideal user, and boundaries for the Anomaly Timeline Reconstruction Prompt.

This prompt is designed for incident investigators, SOC analysts, and security engineers who need to reconstruct a coherent chronological narrative from fragmented, multi-source log events. It takes raw event data from SIEMs, application logs, cloud audit trails, and endpoint telemetry and produces a unified timeline with event correlation, causality hypotheses, and explicit evidence gaps. Use this prompt when you have scattered timestamped events and need a structured timeline that surfaces temporal inconsistencies, missing events, and potential attack chains. This prompt belongs in the investigation phase after initial anomaly detection but before root cause confirmation. It is not a replacement for a SIEM correlation engine; it is a reasoning tool that helps analysts make sense of events that automated rules failed to connect.

The ideal user has access to raw event exports and understands the schema of their log sources, but needs help structuring the narrative. You should provide the prompt with a list of events containing at minimum a timestamp, source system, and event description. The prompt works best when the event set is bounded to a specific time window and set of assets. Do not use this prompt for real-time alert triage or as a substitute for deterministic correlation rules. It is a post-hoc analytical tool. Before invoking the prompt, ensure you have already filtered the event set to the relevant investigation scope—feeding it unfiltered SIEM firehose data will produce noisy, low-quality timelines.

Avoid using this prompt when you need sub-second precision or when events must be legally sequenced for forensic admissibility without human review. The model may hallucinate causal links between unrelated events or invent missing events to fill gaps. Always validate the output against raw logs. The prompt includes explicit instructions to flag evidence gaps rather than fabricate connections, but you should implement a post-processing validation step that checks whether every asserted relationship in the timeline is supported by at least one input event. For high-severity incidents, the reconstructed timeline should be treated as an analyst's working hypothesis, not a finished incident report.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Anomaly Timeline Reconstruction Prompt delivers reliable investigation value and where it introduces operational risk.

01

Good Fit: Post-Detection Investigation

Use when: an anomaly has already been detected by a separate system and an analyst needs a chronological narrative from raw logs. Guardrail: always feed the prompt a pre-filtered set of events from a known time window; do not use it for open-ended anomaly hunting.

02

Bad Fit: Real-Time Alerting

Avoid when: the system must make sub-second decisions on live event streams. Timeline reconstruction requires batch context and reasoning depth that adds unacceptable latency. Guardrail: use this prompt only in async investigation queues, never in the hot path of alert generation.

03

Required Input: Structured Event Logs

Risk: feeding unstructured, multi-source logs without normalization produces hallucinated correlations and phantom events. Guardrail: require a minimum schema of timestamp, event_type, source_system, and raw_event before invoking the prompt. Reject inputs that lack timestamp ordering.

04

Operational Risk: Evidence Gaps Become Narrative

Risk: the model may invent bridging events to create a coherent story when log gaps exist. Guardrail: instruct the prompt to explicitly mark gaps with [EVIDENCE_GAP] tokens and forbid filling gaps with assumed events. Validate output for unsupported causality claims.

05

Operational Risk: Temporal Inconsistency

Risk: clock skew, timezone mismatches, or out-of-order ingestion can produce impossible event sequences that the model treats as valid. Guardrail: pre-process timestamps to a single timezone and validate monotonic ordering before prompt assembly. Include a pre-prompt check that rejects inputs with more than 5% timestamp anomalies.

06

Bad Fit: Single-Source Investigation

Avoid when: all events originate from one system with a known linear sequence. The reconstruction overhead adds no value over simple log filtering. Guardrail: only invoke this prompt when correlating events across two or more independent source systems or log streams.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt for reconstructing incident timelines from scattered log events, with placeholders for your specific data sources and output requirements.

This prompt template is designed for incident investigators who need to build a chronological narrative from fragmented log events across multiple systems. It instructs the model to correlate events, hypothesize causality, identify evidence gaps, and flag temporal inconsistencies. The template uses square-bracket placeholders that you must replace with real values before execution—such as the raw log data, the incident time window, and the required output schema.

text
You are an incident investigator reconstructing a chronological timeline from scattered log events.

## INPUT DATA
[RAW_LOG_EVENTS]

## INCIDENT WINDOW
Start: [START_TIMESTAMP]
End: [END_TIMESTAMP]

## OUTPUT SCHEMA
Return a single JSON object with the following structure:
{
  "timeline": [
    {
      "timestamp": "ISO 8601 string",
      "event_description": "concise description of what occurred",
      "source_system": "system or log file that produced this event",
      "source_event_id": "original event identifier from the source",
      "confidence": "high | medium | low",
      "correlated_events": ["list of related event_ids from this timeline"],
      "causal_relationship": "preceded_by | caused_by | unrelated | unknown"
    }
  ],
  "causality_hypotheses": [
    {
      "hypothesis": "description of a possible causal chain",
      "supporting_events": ["event_ids that support this hypothesis"],
      "contradicting_events": ["event_ids that contradict this hypothesis"],
      "confidence": "high | medium | low"
    }
  ],
  "evidence_gaps": [
    {
      "gap_description": "what information is missing",
      "expected_source": "where this information would normally be found",
      "impact_on_investigation": "how this gap affects conclusions",
      "suggested_remediation": "how to obtain the missing data"
    }
  ],
  "temporal_consistency_checks": [
    {
      "check_type": "out_of_sequence | timestamp_gap | duplicate_event | impossible_ordering",
      "affected_events": ["event_ids involved"],
      "description": "what the inconsistency is",
      "severity": "critical | warning | informational"
    }
  ],
  "investigation_summary": "a concise paragraph summarizing the reconstructed timeline and key findings"
}

## CONSTRAINTS
- Sort all timeline events chronologically. If timestamps are identical, order by logical dependency.
- For each event, assess confidence based on source reliability, timestamp precision, and corroborating evidence.
- Flag any event that appears out of sequence or has an impossible timestamp relative to other events.
- If two events have the same timestamp but conflicting descriptions, mark both with confidence "low" and note the conflict in temporal_consistency_checks.
- Do not invent events. If the evidence is insufficient to establish causality, use "unknown" for causal_relationship.
- For evidence gaps, be specific about what is missing and where it would normally reside.
- If the input data contains fewer than 3 events, return a single evidence_gap entry explaining insufficient data for reconstruction.

## RISK_LEVEL
[HIGH] This output may inform incident response actions. Human review is required before using this timeline for remediation decisions.

Adaptation guidance: Replace [RAW_LOG_EVENTS] with your actual log data, formatted as a list of event objects with at minimum timestamp, event_description, source_system, and source_event_id fields. Replace [START_TIMESTAMP] and [END_TIMESTAMP] with the incident window boundaries. If your investigation requires additional fields—such as user identity, asset tags, or severity scores—add them to the event objects in the input and extend the output schema accordingly. For high-stakes incidents, route the output through a human reviewer before acting on any causality hypotheses. Validate the JSON output against the schema before ingestion into your case management system, and log any schema violations for prompt refinement.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be populated before the prompt is sent to the model. Validation notes describe what makes a value acceptable.

PlaceholderPurposeExampleValidation Notes

[LOG_EVENTS]

Raw, timestamped log entries from one or more systems, including event type, source, and message content.

{"timestamp": "2025-03-21T14:32:01Z", "source": "auth-service", "event": "login_failure", "user": "jdoe", "ip": "10.0.1.45"}

Must be valid JSON array of objects. Each object requires timestamp (ISO 8601), source (non-empty string), and event (non-empty string). Null or empty array triggers missing-information interruption.

[INCIDENT_WINDOW]

The start and end time bounding the investigation period.

{"start": "2025-03-21T14:00:00Z", "end": "2025-03-21T15:00:00Z"}

Must be valid JSON with start and end as ISO 8601 strings. End must be after start. Window exceeding 24 hours requires human approval flag.

[KNOWN_GOOD_PATTERNS]

A list of event sequences or patterns that are considered benign and should not be flagged as anomalies.

["scheduled_backup_start", "health_check_ping", "certificate_renewal"]

Optional array of strings. If provided, each string must match an event type in LOG_EVENTS. Null allowed. Empty array treated as no known-good patterns.

[ASSET_CRITICALITY_MAP]

Mapping of system assets to their criticality tiers for severity weighting.

{"auth-service": "critical", "log-aggregator": "high", "metrics-collector": "low"}

Must be valid JSON object. Keys must match source values in LOG_EVENTS. Values must be one of: critical, high, medium, low. Missing sources default to medium with a warning flag.

[OUTPUT_SCHEMA]

The expected structure for the reconstructed timeline output.

{"timeline": [{"timestamp": "string", "event": "string", "source": "string", "correlation_group": "string|null", "causality_note": "string|null"}], "gaps": [{"start": "string", "end": "string", "missing_context": "string"}], "hypotheses": [{"rank": "integer", "description": "string", "supporting_events": ["string"], "contradicting_events": ["string"]}]}

Must be valid JSON Schema or example structure. Schema check before prompt assembly. If absent, default timeline schema is used. Must include timeline, gaps, and hypotheses arrays.

[TEMPORAL_CONSISTENCY_RULES]

Rules defining valid event ordering and maximum allowed gaps between related events.

{"max_gap_seconds": 300, "required_sequence": ["login_attempt", "login_success"], "forbidden_sequence": ["data_export", "login_failure"]}

Must be valid JSON object. max_gap_seconds must be positive integer. required_sequence and forbidden_sequence are arrays of event type strings. Null allowed if no consistency rules are enforced.

[EVIDENCE_SOURCE_MAP]

Mapping of log sources to their reliability scores and data quality notes.

{"auth-service": {"reliability": 0.99, "latency_seconds": 2}, "firewall": {"reliability": 0.95, "latency_seconds": 30}}

Must be valid JSON object. Keys must match source values in LOG_EVENTS. reliability must be float between 0.0 and 1.0. latency_seconds must be non-negative integer. Missing sources default to reliability 0.5 with a flag.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Anomaly Timeline Reconstruction Prompt into an investigation workflow with validation, retries, and human review gates.

The Anomaly Timeline Reconstruction Prompt is designed to be called after an anomaly detection system has flagged a set of related events. In a production investigation workflow, this prompt should not be the first step. A pre-processing layer should gather the raw log events, normalize timestamps to a single timezone (typically UTC), deduplicate records, and attach source system identifiers before assembling the [EVENT_LOG] input. The prompt expects a structured JSON array of events, each with at minimum a timestamp, event_type, source_system, and description field. If your log sources use inconsistent timestamp formats, normalize them in the application layer before calling the model. The model is not a timestamp parser; it is a reasoning engine that assumes clean temporal data.

Wire this prompt into your investigation pipeline as a synchronous call with a timeout of 60-90 seconds for models like GPT-4o or Claude 3.5 Sonnet when processing 50-200 events. For larger event sets, implement a chunking strategy: split events into overlapping time windows, run the prompt on each window, then use a secondary merge prompt to reconcile overlapping hypotheses and produce a unified timeline. The output schema should be validated programmatically before the timeline reaches a human analyst. Check that every event_id referenced in the correlation_links array exists in the events array, that timestamp fields are ISO 8601 strings, and that causality_hypothesis entries include both confidence (a float between 0.0 and 1.0) and evidence (an array of at least one event_id). If validation fails, retry once with the validation errors appended to the [CONSTRAINTS] block. If the retry also fails, escalate the raw event set and partial output to a human analyst with a note that automated reconstruction was incomplete.

For high-severity incidents where the anomaly risk score exceeds your organization's defined threshold, insert a human review gate after timeline generation. The model's output should be rendered into a visual timeline in your investigation UI, with correlation links shown as annotated arrows and evidence gaps highlighted in amber. Analysts should be able to click any event to see the raw log entry, and click any causality hypothesis to see the supporting and contradictory evidence the model cited. Log every prompt invocation with the model version, input event count, output timeline length, validation pass/fail status, and analyst modifications. This audit trail is essential for post-incident review and for detecting when the model's reconstruction quality drifts due to model updates or changing log patterns. Do not allow the reconstructed timeline to auto-trigger downstream actions such as containment or blocking without human approval, even if the model's confidence scores are high.

IMPLEMENTATION TABLE

Expected Output Contract

Validate the model's JSON output against this contract before accepting the anomaly timeline. Reject or repair any response that does not conform.

Field or ElementType or FormatRequiredValidation Rule

timeline

Array of event objects

Must be a non-empty array. Reject if null or missing.

timeline[].event_id

String

Must be unique within the array. Validate with a duplicate check.

timeline[].timestamp

ISO 8601 String

Must parse to a valid date. Validate temporal ordering is non-decreasing.

timeline[].source_log

String

Must match a known log source identifier from [INPUT_LOG_SOURCES]. Reject unknown sources.

timeline[].description

String

Must be non-empty. Reject if length < 10 characters.

causality_hypotheses

Array of objects

Must be present. Allow empty array if no causal links are found.

causality_hypotheses[].cause_event_id

String

Must reference a valid event_id present in the timeline array.

causality_hypotheses[].effect_event_id

String

Must reference a valid event_id present in the timeline array. Must not be the same as cause_event_id.

causality_hypotheses[].confidence

Number (0.0-1.0)

Must be a float between 0.0 and 1.0 inclusive. Reject if out of bounds.

evidence_gaps

Array of objects

Must be present. Allow empty array if no gaps are identified.

evidence_gaps[].time_range_start

ISO 8601 String or null

If not null, must parse to a valid date and be before time_range_end.

evidence_gaps[].time_range_end

ISO 8601 String or null

If not null, must parse to a valid date and be after time_range_start.

evidence_gaps[].missing_data_description

String

Must be non-empty. Reject if length < 15 characters.

temporal_consistency_score

Number (0.0-1.0)

Must be a float between 0.0 and 1.0 inclusive. A score below 0.5 should trigger a retry or human review flag.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when reconstructing anomaly timelines and how to guard against it.

01

Temporal Ordering Errors

What to watch: The model misorders events when timestamps are in different formats, timezones, or when log sources have clock skew. This produces a timeline that looks coherent but is factually wrong. Guardrail: Normalize all timestamps to UTC before the prompt. Include an explicit instruction to flag any events where ordering is ambiguous due to missing or conflicting time data.

02

Fabricated Causality

What to watch: The model invents causal links between temporally adjacent events without evidence, producing a compelling but false narrative. This is especially common when the prompt asks for root cause hypotheses. Guardrail: Require the model to label each causal link as 'temporal correlation,' 'documented dependency,' or 'hypothesized mechanism.' Flag unsupported causal claims for human review.

03

Silent Evidence Omission

What to watch: The model drops events that don't fit a clean narrative, especially low-severity log lines that later prove critical. The timeline looks complete but is missing key precursors. Guardrail: Instruct the model to explicitly list all input events that were excluded from the timeline and why. Add a 'completeness check' step that compares input event count to output event count.

04

Temporal Gap Blindness

What to watch: The model fails to identify significant gaps where events should exist but don't—such as missing heartbeat signals, log rotation gaps, or silent failure periods. Guardrail: Add a constraint requiring the model to identify and annotate all gaps longer than a specified threshold. Include expected event cadence context so the model knows what 'normal' looks like.

05

Correlation Overload

What to watch: When given high-volume log data, the model over-correlates unrelated events that happen to share timestamps or keywords, producing a timeline cluttered with false connections. Guardrail: Limit the input to a focused time window and relevant event types. Instruct the model to prioritize correlations based on explicit identifiers like trace IDs, session tokens, or hostnames rather than temporal proximity alone.

06

Hypothesis Anchoring

What to watch: The model latches onto the first plausible root cause it identifies and interprets all subsequent events as supporting evidence, ignoring contradictory signals. Guardrail: Require the model to generate at least two competing hypotheses and list evidence for and against each. Include a 'devil's advocate' instruction that asks what would disprove the leading hypothesis.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test output quality before deploying the Anomaly Timeline Reconstruction Prompt into production investigation workflows. Each criterion targets a specific failure mode common in timeline generation.

CriterionPass StandardFailure SignalTest Method

Temporal Ordering

All events are sorted in ascending chronological order with no timestamp inversions

Events appear out of sequence; timestamps contradict the listed order

Parse output timestamps and assert timestamp[i] <= timestamp[i+1] for all events

Event Correlation

Each correlated event group includes a stated relationship type and supporting evidence from the log source

Events are grouped without explanation; correlation type is missing or generic

Check that every group in correlated_events has non-null relationship_type and at least one evidence_source

Causality Hypothesis

Hypotheses are stated as tentative with explicit confidence levels and list both supporting and contradictory evidence

Hypotheses are stated as definitive facts; confidence is absent; only supporting evidence is listed

Assert that each hypothesis object contains confidence_level, supporting_evidence, and contradictory_evidence fields

Evidence Gap Detection

Gaps are identified with a time range, missing event type, and impact on the investigation narrative

Output claims a complete timeline when known log sources have gaps; gaps lack time ranges

Compare evidence_gaps count against a pre-computed expected gap count from source log coverage analysis

Source Grounding

Every timeline event includes a direct reference to the originating log entry or source system

Events appear without source attribution; source is listed as 'unknown' or 'inferred' without basis

Validate that each event in timeline has a non-null source_log_id or source_system field

Temporal Consistency

No event is placed before a prerequisite event; causal chains respect time ordering

An effect event is timestamped before its identified cause; impossible sequences pass validation

Run a rule-based check: for any causes relationship, assert cause.timestamp <= effect.timestamp

Missing Event Flagging

Known expected events that are absent from logs are explicitly noted with search parameters used

Output is silent on missing expected events; no indication that the system looked for them

Provide a list of expected event types in [EXPECTED_EVENTS] and assert each appears in either timeline or evidence_gaps

Uncertainty Disclosure

Events with ambiguous timestamps or conflicting sources are marked with uncertainty flags and alternative interpretations

All events are presented with equal certainty; conflicting log entries are ignored or silently resolved

Check that any event with multiple conflicting source entries has uncertainty_flag: true and populated alternative_interpretations

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a flat list of log events. Remove strict schema enforcement and let the model produce a narrative timeline in markdown. Use a single [LOG_EVENTS] placeholder containing raw timestamps and messages.

Watch for

  • The model inventing events to fill gaps
  • Timestamps parsed inconsistently across formats
  • No separation between confirmed facts and hypotheses
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.