Agentless inputs allow Splunk to collect data from systems without installing a forwarder. This approach is useful in environments where installing an agent isn't feasible. This guide covers input methods, key considerations, and best practices for using agentless inputs effectively.
Splunk supports multiple agentless input methods, including Windows Management Instrumentation (WMI) and REST API-based ingestion.
Add WMI Input Using Splunk Web:
SELECT * FROM Win32_Processor).Example WMI Queries:
Collect Performance Metrics:
SELECT Name, PercentProcessorTime FROM Win32_PerfFormattedData_PerfOS_Processor
Retrieve Security Logs:
SELECT * FROM Win32_NTLogEvent WHERE Logfile='Security'
Assign Metadata:
index, sourcetype, and host for the input.Verify Data Collection:
Search for WMI data in Splunk:
index=windows sourcetype=wmi:perfmon
135 for RPC and dynamic ports for WMI).Write a Script to Fetch Data:
Save the script in $SPLUNK_HOME/bin/scripts/.
Example: Fetching weather data from OpenWeatherMap API.
import requests
import json
# Fetch data from OpenWeatherMap API
response = requests.get("https://api.openweathermap.org/data/2.5/weather?q=London&appid=your_api_key")
data = response.json()
# Print data in JSON format
print(json.dumps(data))
Configure Scripted Input in inputs.conf:
[script://./bin/scripts/fetch_weather.py]
disabled = false
interval = 600
sourcetype = weather_data
index = api_logs
Secure API Connections:
Test and Verify Data:
Run the script manually to check the output:
python ./bin/scripts/fetch_weather.py
Verify ingestion in Splunk:
index=api_logs sourcetype=weather_data
Why Batch?
How to Batch:
In WMI:
Use WHERE clauses to filter large queries.
Example: Collect only critical security events:
SELECT * FROM Win32_NTLogEvent WHERE Logfile='Security' AND EventCode=4625
In REST APIs:
Use the Monitoring Console:
Track Internal Logs:
Monitor _internal logs for input errors:
index=_internal source=*splunkd.log component=ExecProcessor
Goal: Collect security event logs from multiple Windows servers for centralized monitoring in Splunk.
Plan WMI Queries:
4624) and failed logon attempts (4625).Configure WMI in Splunk:
Add WMI inputs via Splunk Web:
Input Type: Event Log
Logfile: Security
Query:
SELECT * FROM Win32_NTLogEvent WHERE Logfile='Security' AND (EventCode=4624 OR EventCode=4625)
Assign Metadata:
wmi:security) and index (windows_logs).Verify Data:
Search for collected events:
index=windows_logs sourcetype=wmi:security EventCode=4624
Optimize for Scale:
Goal: Use a REST API to collect logs from a third-party cloud service for application monitoring.
Understand the API:
Write a Script for Data Collection:
Example: Collecting logs from a service with an API key.
import requests
import json
# Set API URL and headers
url = "https://api.example.com/logs"
headers = {"Authorization": "Bearer your_api_key"}
# Fetch data
response = requests.get(url, headers=headers)
data = response.json()
# Print data in Splunk-compatible format
print(json.dumps(data))
Configure Scripted Input:
Add the script to inputs.conf:
[script://./bin/scripts/fetch_cloud_logs.py]
disabled = false
interval = 300
sourcetype = cloud_logs
index = cloud_index
Verify Data:
Query ingested logs:
index=cloud_index sourcetype=cloud_logs
Implement Error Handling:
Goal: Collect CPU and memory usage data from Windows servers without installing a forwarder.
Configure WMI Queries:
Use the Win32_PerfFormattedData class to retrieve performance metrics:
SELECT Name, PercentProcessorTime, AvailableMBytes FROM Win32_PerfFormattedData_PerfOS_Memory
Add WMI Input:
Performance Counterwmi:perfmon.Monitor Data in Real-Time:
Goal: Set up a WMI input to collect Windows security event logs.
Define the WMI Query:
Filter for login-related events:
SELECT * FROM Win32_NTLogEvent WHERE Logfile='Security' AND EventCode=4624
Add WMI Input in Splunk:
Verify the Input:
Search for collected events:
index=windows_logs sourcetype=wmi:security EventCode=4624
Goal: Use a REST API to collect weather data and ingest it into Splunk.
Write a Script:
Save the following as fetch_weather.py:
import requests
import json
# Fetch weather data
response = requests.get("https://api.openweathermap.org/data/2.5/weather?q=London&appid=your_api_key")
data = response.json()
# Print JSON output
print(json.dumps(data))
Configure Scripted Input:
Add this configuration to inputs.conf:
[script://./bin/scripts/fetch_weather.py]
disabled = false
interval = 600
sourcetype = weather_data
index = api_logs
Test the Script:
Run the script manually:
python ./bin/scripts/fetch_weather.py
Search Data in Splunk:
Verify the ingested data:
index=api_logs sourcetype=weather_data
Cause:
Solution:
Test the WMI query using PowerShell:
Get-WmiObject -Query "SELECT * FROM Win32_NTLogEvent WHERE Logfile='Security'"
Ensure the Splunk user account has permissions to execute WMI queries.
Cause:
Solution:
Check script logs for errors:
python ./bin/scripts/fetch_cloud_logs.py
Verify the script is executable:
chmod +x ./bin/scripts/fetch_cloud_logs.py
Agentless inputs allow Splunk to ingest data without requiring a Universal Forwarder or Heavy Forwarder to be installed on the source system. These methods are essential in environments with strict deployment constraints or in cases where you prefer lightweight integration.
This guide outlines key mechanisms, differences in push vs. pull methods, configuration options, and common pitfalls.
Splunk supports several methods of agentless data ingestion, primarily:
Windows Management Instrumentation (WMI) – for pulling data from Windows systems
REST API Scripts – for pulling data from external web APIs
HTTP Event Collector (HEC) – for receiving pushed data via HTTP/HTTPS
Understanding the difference between push and pull models is important both in real-world deployment and certification exams.
External systems initiate data transmission to Splunk.
Common in cloud services, apps, and logging libraries that support Splunk HEC endpoints.
A cloud-based firewall pushes logs to your HEC endpoint in real time.
Splunk initiates the request to an external API at scheduled intervals.
Typically implemented using a scripted input.
A Python script polls weather data every 10 minutes from a public API and ingests it into Splunk.
Exam Insight:
Expect conceptual questions distinguishing who initiates the data transfer — the source (HEC) or Splunk (REST API script).
Unlike scripted inputs, WMI is not configured via [script://...] in inputs.conf.
Typically configured via Splunk Web:
Settings > Data Inputs > WMI
Choose between:
Event Log
Performance Monitor
Custom WMI Query
This is distinct from scripted inputs, which are file-based and reside in:
$SPLUNK_HOME/etc/apps/<your_app>/bin/
Clarification:
Do not use [script://] stanzas to define WMI inputs. This can confuse new users and mislead configuration-based exam questions.
Here’s a corrected example for Scripted Input (Pulling from REST API):
[script://./bin/fetch_weather.py]
interval = 600
index = weather_index
sourcetype = weather_data
disabled = false
Whereas WMI inputs are not manually defined in inputs.conf but rather managed via GUI or REST endpoints internally.
| Input Type | Pull / Push | Typical Configuration | Use Case |
|---|---|---|---|
| WMI | Pull | Splunk Web UI | Collect Windows logs or performance metrics |
| REST API Script | Pull | [script://] in inputs.conf |
Periodic API polling (e.g., metrics, weather) |
| HEC | Push | HTTP endpoint (via Web or CLI) | Cloud app or service sends data to Splunk |
HEC:
Enable SSL for secure transmission.
Use batch submission to reduce overhead.
Rotate tokens periodically for security.
Scripted Inputs:
Output one event per line, ideally in JSON.
Handle rate limiting and API errors gracefully.
Log script failures for monitoring.
WMI:
Use least privilege for WMI credentials.
Avoid running overly broad or heavy WMI queries.
What is the purpose of the HTTP Event Collector (HEC) in Splunk?
To receive event data over HTTP or HTTPS from external systems.
HTTP Event Collector allows applications, scripts, and external services to send event data directly to Splunk using HTTP or HTTPS requests. This mechanism enables agentless data ingestion because the sending system does not require a Splunk forwarder installation. Data is transmitted through REST-style requests that include event payloads and authentication tokens. HEC is commonly used for cloud services, custom applications, and integrations where installing a forwarder is not practical. Administrators configure HEC endpoints within Splunk and generate tokens to authenticate incoming data sources.
Demand Score: 78
Exam Relevance Score: 90
What role does the token play in HTTP Event Collector?
It authenticates and identifies the data source sending events.
When HTTP Event Collector is enabled, administrators create tokens that act as authentication credentials for incoming event data. Each token can be associated with specific indexes and source configurations. When a client application sends data to the HEC endpoint, it must include the token in the request header. Splunk uses this token to verify that the request is authorized and to determine where the incoming events should be indexed. Using tokens provides secure and flexible management of external data sources.
Demand Score: 74
Exam Relevance Score: 91
What type of input allows Splunk to collect Windows data remotely without installing a forwarder?
WMI input.
Windows Management Instrumentation (WMI) inputs allow Splunk to query Windows systems remotely and collect system information without requiring a Splunk forwarder on the target machine. WMI inputs can retrieve data such as system metrics, performance counters, and event information from Windows hosts. This approach is useful in environments where installing agents is restricted or impractical. However, WMI-based collection may generate additional network overhead and typically requires appropriate credentials and permissions on the target systems.
Demand Score: 70
Exam Relevance Score: 89