What you will learn in this TP
- Run Splunk Enterprise in a container
- Create an index and set its retention
- Create an HEC token limited to one index
- Send events and find them with SPL
All steps and instructions are shown. Recommended for this lab: guided
Introduction #
Context. Your team wants to centralize the online shop's logs. You set up a test Splunk, create a dedicated index and connect the application through the HTTP Event Collector.
Prerequisites: a machine with Docker (4 GB free memory), curl, jq and Python 3 · Estimated time: 40 min
A local Splunk 10.6 with a 30-day retentionweb index holding 3,000 events received via HEC.Setup #
Guided steps, with their solution.
1. Run Splunk
Why? The official container configures Splunk at startup: license, general terms, password and HEC enabled.
Runsplunk/splunk:10.6.2with ports 8000, 8088, 8089 and 9997, wait for the healthy state (2 to 3 minutes) and print the version via the API.2. Create the index and token
Why? A dedicated index carries its own permissions and retention; a token limited to that index prevents an application from writing elsewhere.
Through the REST API, create thewebindex (30-day retention) then an HEC tokentp_webwhose default and only allowed index isweb.3. Send events
Why? HEC accepts several JSON events in one request: batch sending is much more efficient.
Generate 3,000 access events spread over the last 24 hours and send them in batches of 500. Each response must be{"text":"Success","code":0}.4. Search
Why? Checking the event count and fields validates the whole chain: token, index, timestamp and JSON extraction.
Log in tohttp://localhost:8000(admin). Count events in thewebindex over 24 hours, per host, and display the list of extracted fields.5. Check via the API
Why? Automating a check through the API is the basis of platform acceptance tests.
Run the same search through/services/search/jobs/exportas CSV, then check the index size with| rest.
Validate your work
Check that each goal above is reached and that you get the result described in the introduction.
Difficulty level : ●●○○○ (2/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Advanced SPL and knowledge objects
Going further with Splunk: CSV and KV store lookups, eventstats and streamstats, transaction vers...
The observability trilemma: cost, completeness and performance, and how solutions resolve it
Understanding the observability trilemma (cost, data completeness, query performance), its three ...
Observability on AWS: CloudWatch, X-Ray, Application Signals, ADOT, Managed Prometheus and Grafana
A complete overview of observability on AWS: CloudWatch components (metrics, logs, alarms, Applic...
Cribl Edge: collecting close to the sources
Deploying Cribl Edge on Linux, Windows and Kubernetes: the agent's role, Fleets and Subfleets, co...
Logs with OpenTelemetry: data model, appenders, correlation and collection
Master the log signal: the LogRecord data model, the Logs Bridge API and appenders (Logback, Log4...
Installing OpenObserve and ingesting your first data
Install OpenObserve with Docker Compose or the binary, configure it with its ZO_* variables, send...
Elastic path project: centralising and using logs
The validation project of the "Elastic Stack mastery" path: Elastic Agent and Fleet, Logstash, El...
Archiving, replaying and searching: S3, Replay, Cribl Lake and Cribl Search
Keeping all data cheaply and finding it on demand: partitioned S3 destination, JSON and Parquet f...
Mimir: compactor, retention and object storage
Configure Mimir object storage (S3, GCS, Azure, MinIO), understand compaction and split-and-merge...