VMware ESXi and vSphere Cluster Management

Splunk Online Tutorial: Collect, Search, Analyze, Report, and Alert on Machine Data

Learn Splunk fundamentals: install Splunk, collect local and remote logs, search with SPL, analyze events, create reports, and configure alerts.

Splunk is a platform for collecting, indexing, searching, monitoring, and analyzing machine-generated data. This tutorial introduces the complete workflow: install Splunk, ingest logs, search events, summarize results, create reports, and alert on important conditions.

The examples are intended for beginners, system administrators, operations teams, support teams, and security analysts. You should understand basic files and folders, text logs, hostnames, ports, and network connectivity. Linux examples also assume basic command-line familiarity.

What Is Splunk?

Machine data is information produced by operating systems, applications, servers, network devices, cloud services, and other infrastructure. It commonly appears as log files, event records, metrics, or messages.

Splunk collects this data, stores it in searchable indexes, and provides tools for finding relationships and patterns. Instead of logging in to many computers and opening files individually, an operator can search relevant data from one interface.

Common Machine-Data Sources

  • Operating-system logs: authentication events, service messages, kernel messages, and system errors.
  • Application logs: exceptions, transactions, warnings, user actions, and application status.
  • Web-server logs: requests, response codes, client addresses, URLs, and response times.
  • Device logs: firewall, router, switch, storage, and other infrastructure events.
  • Custom text files: logs generated by scripts, internal tools, and line-oriented services.

Structured, Semi-Structured, and Unstructured Data

Structured data follows a consistent schema, such as a CSV record with fixed columns or a JSON object with named keys. Semi-structured data has recognizable patterns but may vary between events, such as key-value log messages. Unstructured textual data is free-form text, such as a sentence written by an application.

Splunk can index all three types. Fields may be available automatically when the format is recognizable, or they may require manual extraction and normalization.

Why Centralized Indexing Matters

Centralized indexing makes data available through a common search layer. It supports faster incident investigation, cross-system correlation, historical analysis, operational monitoring, and consistent reporting. Search quality depends on accurate timestamps and useful metadata such as host, source, source type, and index.

Splunk Capabilities and Use Cases

  • Historical searching: examines events already indexed within a selected time range.
  • Real-time searching: continuously evaluates newly arriving events.
  • Operational monitoring: tracks service failures, resource symptoms, request errors, and system health.
  • Incident investigation: correlates events from several hosts, applications, or devices.
  • Statistical analysis: counts, groups, compares, and summarizes events.
  • Trend identification: reveals gradual changes, spikes, recurring failures, and unusual activity.
  • Reports: save repeatable searches for periodic review.
  • Alerts: notify operators when a search meets a defined condition.

Splunk Architecture

A basic Splunk Enterprise deployment may combine a Splunk instance, local inputs, forwarders, indexes, and Splunk Web. Larger deployments separate search and storage responsibilities across multiple components.

ComponentPrimary roleTypical use
Splunk WebBrowser-based interfaceSearch, analysis, administration, reports, and alerts
IndexerReceives, processes, stores, and searches eventsMaintains indexed data
IndexLogical data store for eventsSeparates and organizes data for efficient search
ForwarderCollects data and sends it to an indexerMoves endpoint data to a central platform
Universal ForwarderLightweight endpoint collectorMonitors files and operating-system logs
Search headRuns searches and presents resultsScales search activity in larger deployments

The typical data flow is:

  1. A source creates a log or event.
  2. A local Splunk input or forwarder collects it.
  3. The data travels to an indexer, usually over a configured receiving port.
  4. The indexer parses and stores events in an index.
  5. Splunk Web or a search head runs SPL against the indexed events.
  6. Results can become visualizations, reports, or alert actions.

Installing and Starting Splunk

Use the installer or package appropriate for your operating system and architecture. Obtain it from your organization's approved software source, then follow the platform-specific installation procedure. Plan storage, memory, network access, administrator credentials, and data retention before using Splunk with production data.

Windows Installation

  1. Run the Splunk Enterprise installer with an account permitted to install software.
  2. Accept the license terms and choose the installation directory.
  3. Create the first administrator account when prompted.
  4. Choose whether Splunk should start as a Windows service.
  5. Allow the Splunk Web and receiving ports through host firewalls only when required.
  6. Open a browser to the configured Splunk Web address, commonly https://localhost:8000 for a local installation.

On Windows, service management can be performed through the Services console or the installed Splunk service controls. Verify that the service is running before troubleshooting the browser connection.

Linux Installation

Install the package or archive suited to the Linux distribution and CPU architecture. The commands below assume that the Splunk command is available from its installation directory:

./splunk start
./splunk status
./splunk stop
./splunk enable boot-start

The first start displays the license agreement and prompts for an administrator account. After accepting the license and creating credentials, access Splunk Web at the configured address, commonly https://localhost:8000.

Initial Verification

  • Confirm the Splunk service is running.
  • Sign in to Splunk Web with the administrative account created during first run.
  • Open the Search and Reporting experience.
  • Confirm that the intended index exists or create one according to your deployment policy.
  • Ingest a small test source and verify that events appear.

Collecting Local Log Data

Local file monitoring reads a file or directory on the Splunk instance and sends new content to the indexer. In Splunk Web, open the data-input or file-monitoring workflow, select the path, and assign metadata.

For each input, specify:

  • Host: the system that generated the event.
  • Source: the input origin, often a file path.
  • Source type: the format or category used for parsing.
  • Destination index: the logical store where events will be placed.

Common Linux locations include system authentication and service logs under /var/log. Windows collection commonly involves Windows Event Log inputs or application log directories. Select only the files needed for the task.

Example Local Input Configuration

[monitor:///var/log/syslog]
index = main
sourcetype = syslog

After saving the input, generate or wait for new log activity, then search the selected index. Avoid configuring overlapping monitors for the same file because duplicate inputs can produce duplicate events. Also verify that the Splunk process can read the file and that log rotation behavior is supported by the input configuration.

Collecting Data from Remote Computers

Remote forwarding is used when logs are created on another computer. A Universal Forwarder is installed on the endpoint, monitors approved inputs, and sends events to one or more indexers. This avoids manually copying files and provides a consistent collection method.

Basic Forwarder Setup

  1. Install the Universal Forwarder on the Windows or Linux endpoint.
  2. Configure the endpoint to send data to the indexer's receiving hostname and port.
  3. Configure the indexer to listen for forwarded data.
  4. Define the endpoint's monitored files or event sources.
  5. Assign the intended host, source type, and index metadata.
  6. Restart or reload the forwarder configuration as required.
  7. Search the destination index and verify events from the remote host.

Forwarding Destination

[tcpout]
defaultGroup = primary_indexers

[tcpout:primary_indexers]
server = indexer.example.com:9997

The hostname and port in this example are placeholders for your own indexer configuration. Confirm DNS or name resolution, routing, firewall rules, certificate requirements, and the indexer's receiving configuration.

Windows and Linux Endpoint Considerations

  • On Windows, the forwarder service account needs permission to read the selected files or event channels.
  • On Linux, check file ownership, group permissions, SELinux or other security controls, and log rotation.
  • Use a deployment method that keeps forwarder versions and configurations consistent.
  • Monitor the forwarder itself so stopped services and blocked connections are detected.

Events, Fields, Metadata, and Time

An event is an individual record ingested into Splunk. It normally includes event text, a timestamp, and metadata describing its origin.

FieldMeaningExample use in search
_timeEvent timestampRestrict searches and build time charts
hostSystem that generated the eventhost=web01
sourceInput origin, such as a file pathsource="/var/log/syslog"
sourcetypeEvent format or classificationsourcetype=syslog
indexLogical data storeindex=main
Custom fieldNamed value extracted from event contentstatus=500 or severity=error

Fields can be extracted automatically from recognizable formats, or manually with field-extraction rules, configuration, or SPL commands. Reliable fields make grouping and filtering much easier than searching raw text alone.

Time ranges are essential. A search for the last hour can differ greatly from the same search over the last 30 days. Incorrect timestamps can place events outside the expected time window, causing apparently missing or misleading results.

Searching with Splunk Web

Open the Search and Reporting experience. The search bar accepts keywords and SPL, while the time-range picker controls which events are examined. Results commonly include an event list, field sidebar, event context, statistics, and visualization views.

Basic Searches

index=main
index=main host=web01
index=main "error"
index=main (error OR failed)
index=main sourcetype=access_combined

Use quoted phrases when words must appear together. Boolean operators such as OR, AND, and NOT make conditions explicit. Narrow searches with index, host, source, source type, and a suitable time range.

Reviewing and Saving Results

  • Inspect the event timestamp and surrounding event context.
  • Use the field sidebar to discover fields and common values.
  • Compare the Events, Statistics, and Visualization views.
  • Expand the time range when results appear incomplete.
  • Save a useful search as a report or knowledge object according to your permissions.

SPL Fundamentals

Search Processing Language (SPL) is Splunk's language for retrieving, filtering, transforming, and analyzing events. SPL uses a pipeline character, |, to send the output of one command to the next command.

Build searches from left to right: begin with the smallest useful event set, then add one transformation at a time. Run each stage and inspect the result before adding the next stage.

CommandPurposeTypical output
searchFilters eventsA smaller event set
fieldsSelects or removes fieldsEvents containing chosen fields
statsCounts and aggregatesSummary rows and values
timechartAggregates over timeTime-series results
sortOrders resultsSorted events or rows
tableDisplays selected columnsTabular results

Filtering, Grouping, and Sorting Examples

index=main error | stats count by host
index=main error | timechart count
index=main | fields _time host source sourcetype
index=main | sort - _time
index=main status=500 | stats count by host

The first search counts error events by host. The second creates a time-based count. The third limits visible fields. The fourth sorts newest events first. The fifth identifies which hosts produced the most HTTP 500 responses or other events with a matching status field.

Statistical Analysis and Visualization

Aggregation turns many events into a smaller summary. Group by host to compare servers, by severity to understand impact, by source to locate noisy inputs, or by another extracted field that represents the question being investigated.

  • Use a table for exact values and operational lists.
  • Use a column or bar chart to compare hosts, sources, or categories.
  • Use a line chart or timechart to show activity over time.
  • Use a single-value visualization for a key count or current status.

Interpret trends in context. A spike may indicate an outage, deployment, traffic increase, scanning activity, or a logging change. Compare it with related hosts and time periods before concluding that it represents a fault.

Example: Authentication Failures

index=main ("authentication failure" OR "failed login") earliest=-24h
| stats count by host

This searches the previous 24 hours and counts matching events by host. The exact message depends on the operating system and source type, so inspect sample events before finalizing the search.

Example: Error Spike

index=main error earliest=-24h
| timechart span=1h count

Plot the result to identify hours with unusual error volume. Adjust the time span for the amount of data and the operational question.

Reports

A report is a saved search intended for repeatable analysis. After refining a search, use Splunk Web's save workflow, name the report clearly, set its default time range, and choose a table or visualization.

Reports can be scheduled, for example, to run daily for the previous day. Configure permissions so the intended team can use the report, and document the index, time range, assumptions, and field definitions.

Alerts

An alert is a saved search that triggers an action when results meet defined conditions. Create one from a tested SPL search, then choose scheduled or real-time evaluation.

  • Scheduled alert: runs at intervals over a defined time window and is often suitable for periodic thresholds.
  • Real-time alert: continuously evaluates incoming events and can react quickly, but may generate noise if the search is broad.

Configure the trigger condition, threshold, evaluation window, and action. Available actions may include email and webhook-style notification, depending on the deployment and installed integrations. Use throttling or suppression to limit repeated notifications for the same condition.

Alert Design Example

index=main ("authentication failure" OR "failed login") earliest=-15m
| stats count as failures by host

An alert can trigger when failures exceeds a threshold for a host. Choose the threshold from normal baseline behavior rather than an arbitrary value. Exclude expected test activity and use throttling when one incident produces many matching events.

Reports Compared With Alerts

CapabilityReportAlert
Primary purposeRecurring analysis and reviewAction when a condition is met
Typical outputTable, chart, or scheduled resultEmail, webhook-style notification, or another action
TimingUsually scheduled or run manuallyScheduled or real-time
Noise controlUsually not urgentThresholds, suppression, and throttling are important

End-to-End Beginner Workflow

  1. Install Splunk Enterprise on a test Windows or Linux system.
  2. Start the service, complete first-run setup, and sign in to Splunk Web.
  3. Choose a small local log source and configure file monitoring.
  4. Assign a meaningful index, host, source, and source type.
  5. Confirm new events are indexed with a suitable time range.
  6. Optionally install a Universal Forwarder on a remote endpoint and configure its receiving destination.
  7. Search by index, host, source type, and terms such as error or failed.
  8. Use stats to count events by host or severity.
  9. Use timechart to identify spikes and trends.
  10. Save a useful summary as a daily report.
  11. Create an alert for a tested operational condition and configure a sensible threshold.
  12. Test the report and alert, then document ownership and expected response.

Troubleshooting

Splunk Web Cannot Be Opened

  • Confirm that the Splunk service is running.
  • Verify that the configured Web port is reachable.
  • Check host firewall rules and local network access.
  • Review Splunk service logs for startup failures.

A Local Log File Does Not Appear

  • Confirm the exact path in the input configuration.
  • Verify that the Splunk process can read the file.
  • Check the selected index and time range.
  • Confirm that new data is being written to the file.
  • Inspect input status and internal logs for ingestion errors.

Remote Events Do Not Arrive

  • Confirm that the forwarder service is running.
  • Verify the indexer hostname, receiving port, and network reachability.
  • Confirm that the indexer is configured to receive forwarded data.
  • Check firewall rules between the endpoint and indexer.
  • Review forwarder logs for connection or SSL-related errors.

Search Results Are Empty or Incomplete

  • Expand the time range.
  • Verify the selected index.
  • Remove overly restrictive host, source, or source-type filters.
  • Confirm timestamp extraction and timezone behavior.
  • Ensure that the expected events have actually been indexed.

An Alert Sends Too Many Notifications

  • Increase the threshold or narrow the search.
  • Use an evaluation window that matches the condition.
  • Add throttling or suppression.
  • Exclude expected noisy events.
  • Use scheduled alerting when continuous real-time evaluation is unnecessary.

Exam-Relevant Notes

Next Steps

After mastering this workflow, continue with data onboarding, field extraction, SPL techniques, dashboards, Universal Forwarder deployment, Windows Event Log collection, Linux logging, and larger Splunk Enterprise architectures.