Splunk
Table of Contents
Data platform for ingesting, indexing, searching, and visualising machine-generated data at scale. Primary use in security is as a SIEM — centralising logs from endpoints, network devices, and cloud services, then searching and alerting on them. The internal rollout will make this a core tool for the team's escalation handling and threat visibility.
Web UI: http://localhost:8000 (default)
Related: Splunk Query Language (SPL) SIEM Windows Event Logs
Architecture
Forwarder (on endpoints) → Indexer (stores data) → Search Head (query/UI) Components: — Universal Forwarder: lightweight agent, collects and forwards logs — Heavy Forwarder: parses/filters data before forwarding — Indexer: receives, indexes, and stores data in indexes — Search Head: provides the web UI and search interface — Deployment Server: manages forwarder configuration at scale All-in-one (single instance) is standard for small deployments and home lab — one process handles all roles.
Installation (Linux)
# Download .deb or .rpm from https://www.splunk.com/en_us/download.html # Debian/Ubuntu sudo dpkg -i splunk-<version>-linux-<architecture>.deb # Start and accept license sudo /opt/splunk/bin/splunk start --accept-license # Enable on boot sudo /opt/splunk/bin/splunk enable boot-start # Access web UI # http://localhost:8000 (admin / password set on first start)
Universal Forwarder Deployment
Run on endpoints to ship logs to the indexer.
# Install forwarder (separate package from full Splunk) sudo dpkg -i splunkforwarder-<version>-linux-amd64.deb # Configure the receiving indexer sudo /opt/splunkforwarder/bin/splunk add forward-server $INDEXER_IP:9997 # Monitor a log file sudo /opt/splunkforwarder/bin/splunk add monitor /var/log/syslog # Monitor Windows Event Log (on Windows) # Set in inputs.conf or via Deployment Server # Start forwarder sudo /opt/splunkforwarder/bin/splunk start
inputs.conf (forwarder configuration)
# /opt/splunkforwarder/etc/system/local/inputs.conf # Monitor a log file [monitor:///var/log/auth.log] index = linux_logs sourcetype = linux_secure # Monitor all files in a directory [monitor:///var/log/apache2/] index = web sourcetype = access_combined # Windows Event Log (on Windows forwarder) [WinEventLog://Security] index = wineventlog disabled = false [WinEventLog://System] index = wineventlog disabled = false [WinEventLog://Microsoft-Windows-Sysmon/Operational] index = sysmon disabled = false
Core Configuration Files
All in /opt/splunk/etc/system/local/ (or per-app in
/opt/splunk/etc/apps/<appname>/local/):
| File | Purpose |
|---|---|
inputs.conf |
Data sources — what to collect |
outputs.conf |
Where to forward data (forwarders) |
indexes.conf |
Define custom indexes |
props.conf |
Sourcetype parsing and field extraction |
transforms.conf |
Field transformations and lookups |
server.conf |
Splunk server settings |
Creating a custom index
# /opt/splunk/etc/system/local/indexes.conf [my_security_index] homePath = $SPLUNK_DB/my_security_index/db coldPath = $SPLUNK_DB/my_security_index/colddb thawedPath = $SPLUNK_DB/my_security_index/thaweddb maxDataSize = auto_high_volume maxTotalDataSizeMB = 10240
SPL — Search Processing Language
See Splunk Query Language for full SPL reference. Quick examples for security work:
| Search all indexes index=* | head 20 | Windows failed logons index=wineventlog EventCode=4625 | stats count by Account_Name, Source_Network_Address | sort -count | Brute force detection index=wineventlog EventCode=4625 | bucket _time span=5m | stats count by _time, Account_Name | where count > 10 | Top sources by event volume index=* | stats count by host, sourcetype | sort -count | head 20 | Sysmon process creation index=sysmon EventCode=1 | table _time, ComputerName, ParentCommandLine, CommandLine, User | Search for PowerShell download cradles index=sysmon EventCode=1 CommandLine="*DownloadString*" OR CommandLine="*WebClient*" | table _time, ComputerName, User, CommandLine
Alerts
Search → Save As → Alert — Schedule: run every N minutes/hours — Trigger conditions: number of results > 0 — Actions: send email, run script, webhook (e.g. to Slack) Alert throttling: suppress duplicate alerts for a time window — prevents alert fatigue on noisy conditions
Dashboards
Dashboards → Create New Dashboard — Add panels: search results, charts, single value, maps — Panels can share a time range control — Export as PDF or set up scheduled delivery Useful security dashboard panels: — Failed login count (sparkline trend) — Top source IPs for failed logins — Event volume by index over time — Sysmon process creation events by host
Splunk Apps for Security
Splunkbase (https://splunkbase.splunk.com) — official app marketplace Key security apps: — Splunk Security Essentials: pre-built detections and content — Splunk App for Windows Infrastructure: Windows log analysis — Splunk MITRE ATT&CK App: map detections to ATT&CK techniques — Lookup File Editor: manage lookup tables via UI
Useful CLI Commands
# Start / stop / restart sudo /opt/splunk/bin/splunk start sudo /opt/splunk/bin/splunk stop sudo /opt/splunk/bin/splunk restart # Check status sudo /opt/splunk/bin/splunk status # Search from CLI sudo /opt/splunk/bin/splunk search "index=* | head 10" -auth admin:password # List indexes sudo /opt/splunk/bin/splunk list index # Show forwarder connections (on indexer) sudo /opt/splunk/bin/splunk list forward-server
Splunk Python SDK
import splunklib.client as client # Connect service = client.connect( host="localhost", port=8089, username="admin", password="password" ) # Run a search job = service.jobs.create( "search index=wineventlog EventCode=4625 | stats count by Account_Name", exec_mode="blocking" ) # Get results import splunklib.results as results for result in results.JSONResultsReader(job.results(output_mode="json")): print(result)
pip install splunk-sdk --break-system-packages
Tips
- Always use a dedicated index per data source type — mixing everything into the default index makes searching slower and retention management harder
- The Universal Forwarder is very lightweight — deploy it on every endpoint you want visibility into
- For the internal rollout, Windows Event Log + Sysmon via forwarder gives the best endpoint visibility for the least configuration effort
- Saved searches and alerts are stored in
/opt/splunk/etc/users/<user>/search/local/saved_searches.conf— back these up - The Splunk Python SDK is the bridge between your Python skills and the Splunk rollout — worth exploring once the platform is deployed