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
Splunk: the machine data platform at a glance
Discover Splunk: the platform's role, components (forwarders, indexers, search heads), ports, eve...
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...
Splunk best practices
Best practices for running Splunk in production: data quality and sourcetypes, index design, lice...
Administering distributed Splunk
Designing and administering a production Splunk platform: reference architectures, indexer cluste...
SPL: Splunk search fundamentals
Learning the SPL language: search structure, time range and time modifiers, search modes, filteri...
Sources, destinations and routes in Cribl Stream
Receiving and sending data with Cribl Stream: push, pull, collector and internal sources, event b...
Security and observability with Splunk
Splunk solutions beyond search: Enterprise Security (detections, findings, risk-based alerting, a...
Kibana: role, installation and first steps
What Kibana is in the Elastic suite, how to install it with Elasticsearch (start-local, Docker), ...