RousselTMLEARNING

TP · Splunk: from discovery to expertise

Lab: Investigate an incident with SPL

What you will learn in this TP
  • Aggregate and compare with stats and timechart
  • Categorize with eval and case
  • Compare each event with its group (eventstats)
  • Extract a field with rex
  • Enrich with a lookup
  • Count without reading events using tstats
Mode :

All steps and instructions are shown. Recommended for this lab: semi-guided

Introduction #

Context. Customers have been complaining about payment failures since yesterday. The manager wants to know which pages are affected, since when, which users, and whether a browser is involved.

Prerequisites: a machine with Docker (4 GB free memory), curl, jq and Python 3, Lab 1 completed  ·  Estimated time: 45 min

Six searches answering the incident questions, one enriched with a lookup table and one using tstats.

Setup #

Guided steps, with their solution.

  1. 1. Locate errors

    Why? Starting wide then narrowing avoids missing an affected page.

    Count server errors (5xx) per URL, then show their trend per 30-minute slot for the two most affected URLs.
  2. 2. Compute an error rate

    Why? The error count depends on traffic; the rate lets you compare pages with each other.

    For each URL, compute requests, 5xx errors, error rate in % and p95 of duration_ms, with a readable category using case().
  3. 3. Find abnormal requests

    Why? A fixed threshold does not suit every page: compare each request with its own URL's average.

    With eventstats, keep requests more than three times slower than their URL's average, and count them per URL and code.
  4. 4. Extract the browser

    Why? Useful data is often buried in a text field: rex makes it usable without touching ingestion.

    Extract the browser name and version from useragent, then check whether payment errors concern a particular browser.
  5. 5. Enrich with a lookup

    Why? A lookup table turns codes into labels everyone understands, without storing them in each event.

    Copy http_status.csv into the search app, then count requests per category and label using lookup.
  6. 6. Count with tstats

    Why? tstats reads index files: the right habit for dashboards and large volumes.

    Count web index events per hour and per host with tstats, then compare execution time with the equivalent stats search in the Job Inspector.

Validate your work

Check that each goal above is reached and that you get the result described in the introduction.

Difficulty level : ●●●○○ (3/5)

My progress

  • ⏱ Estimated time : ≈ 45 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

SPL: Splunk search fundamentals

Learning the SPL language: search structure, time range and time modifiers, search modes, filteri...

Advanced SPL and knowledge objects

Going further with Splunk: CSV and KV store lookups, eventstats and streamstats, transaction vers...

Splunk: the machine data platform at a glance

Discover Splunk: the platform's role, components (forwarders, indexers, search heads), ports, eve...

Observability, SRE and incident management for DevOps teams

Operate what you ship: metrics, logs and traces, golden signals, SLIs, SLOs and error budgets, ac...

Pipelines and functions: parse, enrich, mask

Building Cribl Stream pipelines: pre-processing, processing and post-processing, the function cat...

Installing Splunk and ingesting data

Installing Splunk Enterprise (package or Docker), understanding $SPLUNK_HOME and configuration fi...

Dashboards, reports and alerts in Splunk

Making the most of Splunk searches: reports and scheduling, Dashboard Studio dashboards (data sou...

Administering distributed Splunk

Designing and administering a production Splunk platform: reference architectures, indexer cluste...

Security and observability with Splunk

Splunk solutions beyond search: Enterprise Security (detections, findings, risk-based alerting, a...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!