Splunk is a centralized log aggregation, monitoring, searching, and analytics platform used to collect machine-generated data from applications, servers, containers, cloud services, and infrastructure.
Spring Boot App
|
v
Application Log File
(/var/log/app.log)
|
v
Universal Forwarder
|
v
Indexer
|
v
Search Head
|
v
Dashboard / Alerts
| Component | Purpose |
|---|---|
| Forwarder | Collects logs from servers |
| Indexer | Indexes and stores logs |
| Search Head | Executes searches and dashboards |
| Deployment Server | Manages forwarders |
| Cluster Master | Manages indexer clusters |
INFO Order Created ERROR Payment Failed WARN Retry Attempt DEBUG API Response
| Framework | Description |
|---|---|
| Logback | Default Spring Boot Logger |
| Log4j2 | High-performance logging |
| SLF4J | Logging abstraction layer |
Always use JSON logging.
<encoder class= "net.logstash.logback.encoder.LogstashEncoder"/>Sample Output:
{
"timestamp":"2026-04-16T10:00:00",
"service":"order-service",
"level":"ERROR",
"traceId":"abc123",
"message":"Payment failed"
}
Most important concept in Microservices logging.
MDC.put( "traceId", UUID.randomUUID().toString() );Log Pattern:
%X{traceId}
Benefits:
index=app_logs level=ERRORSearch Service Logs:
index=app_logs service=payment-serviceSearch By TraceId:
traceId=abc123Last 15 Minutes:
index=app_logs earliest=-15mSearch Exceptions:
"NullPointerException" OR "TimeoutException"Count Errors:
index=app_logs level=ERROR | stats count by serviceTop 10 Errors:
index=app_logs level=ERROR | top limit=10 exception
<appender name="FILE" class= "ch.qos.logback.core.rolling.RollingFileAppender"> <file> /var/log/app.log </file> </appender>
./splunk add monitor /var/log/app.log
restTemplate.postForObject( "https://splunk:8088/services/collector", payload, String.class );
Spring Boot | Logstash | Splunk
service=payment-service level=ERRORFind TraceId:
traceId=xyz789Track Across Services:
Order Service
|
Payment Service
|
Notification Service
Root Cause Found:
Database TimeoutResolution:
Increase DB Connection Pool Optimize Query
index=app_logs level=ERROR | stats countAlert Condition:
count > 50 within 5 minutesNotification:
| Tool | Purpose |
|---|---|
| Splunk | Log Analytics |
| ELK | Open Source Log Analytics |
| Prometheus | Metrics Collection |
| Grafana | Visualization |
| Question | One-Line Answer |
|---|---|
| Splunk | Centralized log monitoring and analytics platform. |
| Indexer | Stores and indexes logs. |
| Search Head | Provides search and dashboard functionality. |
| Forwarder | Collects logs from servers. |
| TraceId | Unique identifier for tracking requests across services. |
| Structured Logging | Logging in JSON format for easy parsing. |
| HEC | HTTP Event Collector for direct log ingestion. |
| RCA | Root Cause Analysis of production issues. |
| SPL | Search Processing Language used in Splunk. |
| Dashboard | Visual representation of log data. |
| Alert | Notification triggered by search conditions. |
| Best Practice | Always use JSON logs with traceId. |
| Splunk vs Prometheus | Logs vs Metrics. |
| Splunk vs ELK | Commercial vs Open Source logging solution. |
Splunk is a centralized log aggregation, monitoring, and analytics platform used to collect, index, search, and visualize logs from distributed systems. In Spring Boot applications, logs are generated using Logback or Log4j2 and are typically written in structured JSON format. These logs are forwarded to Splunk through a Universal Forwarder, HTTP Event Collector (HEC), or Logstash pipeline. We include traceId or correlationId in logs to track requests across microservices. Splunk allows real-time log searching using SPL queries, dashboard creation, alerting, and root cause analysis. It plays a critical role in monitoring production systems, troubleshooting failures, and maintaining application reliability.