Skip to main content
Available in: v2.5.0+ View Log Aggregation Setup →

Overview

This guide provides platform-specific query examples for common log analysis tasks across all 6 supported platforms.

AWS CloudWatch Insights

Query Language

CloudWatch Insights uses a SQL-like query language with piped commands.

Common Queries

Find All Errors

Errors by User

Trace-Specific Logs

Slow Requests (Performance)

Error Rate Over Time

Top Error Messages


GCP Log Explorer

Query Language

GCP uses a custom query language with filters and boolean logic.

Common Queries

Find All Errors

Trace-Specific Logs

Errors in Last Hour

Search by User ID

Authentication Failures

High Memory Usage


Azure Monitor (KQL)

Query Language

Azure uses Kusto Query Language (KQL), a powerful query language similar to SQL.

Common Queries

Find All Errors

Errors by Service

Trace-Specific Logs

Request Duration Analysis

User Activity Timeline

Error Rate Trend


Elasticsearch (Kibana)

Query Language

Elasticsearch uses Query DSL (JSON-based) or KQL in Kibana.

Common Queries

Find All Errors (Query DSL)

Trace-Specific Logs

Time Range + Level Filter

Aggregation: Errors by User

Kibana KQL (Discover Tab)

message: “authentication failed” AND user_id: “alice”

Trace-Specific Logs

Errors by Service

User-Specific Logs

Time Range + Error Filter

Authentication Failures

High Latency Requests

Errors with Stack Traces

Datadog Analytics

Error Count by User

P95 Request Duration

Error Rate Over Time


Splunk (SPL)

Query Language

Splunk uses Search Processing Language (SPL).

Common Queries

Find All Errors

Trace-Specific Logs

Errors by User

Time Range + Level Filter

Error Rate Over Time

Top Error Messages

Request Duration Statistics

User Activity Timeline


Common Use Cases

1. Distributed Tracing

Find all logs for a specific request (across all platforms):

2. Error Investigation

Find errors and group by type:

3. Performance Analysis

Find slow requests (>1s):

4. Security Monitoring

Detect authentication failures:

Advanced Queries

Multi-Field Correlation

Find errors for specific user in specific time range:

CloudWatch

Azure (KQL)

Datadog

Statistical Analysis

Calculate P95, P99 latency:

CloudWatch

Azure (KQL)

Splunk


Best Practices

1. Use Structured Fields

Always query on structured fields (not text search on message):

2. Limit Time Ranges

Always specify time ranges for better performance:

3. Use Trace IDs

For request debugging, always use trace_id:

4. Aggregate When Possible

Use aggregations instead of returning all results:

5. Index Patterns

Ensure proper index patterns for fast queries:
  • Elasticsearch: Use index templates
  • Splunk: Configure index-time field extraction
  • Datadog: Define facets for frequently queried fields

Troubleshooting Queries

No Results Found

  1. Check time range - Logs might be outside selected window
  2. Verify field names - Use autocomplete or schema browser
  3. Check index/source - Ensure querying correct data source
  4. Validate syntax - Platform-specific syntax varies

Slow Queries

  1. Add time range - Limit data scanned
  2. Use indexed fields - Query on indexed fields only
  3. Avoid wildcards - Especially leading wildcards (*error)
  4. Reduce result size - Use | head or | limit

Missing Fields

  1. Check JSON structure - Use fields @message to see all fields
  2. Verify field mapping - Fields must be extracted/mapped correctly
  3. Check log format - Ensure JSON logging is enabled (LOG_FORMAT=json)

Next Steps