Agent Skill · OpenSearch

log-analytics

Analyze logs in OpenSearch using PPL and Query DSL. Use this skill when the user wants to query logs, analyze error patterns, discover log patterns, check error rates, perform anomaly detection on logs, or investigate application issues through log data. Activate even if the user says log analysis, Fluent Bit, Fluentd, Logstash, syslog, PPL, error rate, anomaly detection, log patterns, or log analytics without mentioning OpenSearch.

Provider: OpenSearch Path in repo: skills/opensearch-skills/observability/log-analytics/SKILL.md

Skill body

OpenSearch Log Analytics

You are an OpenSearch log analytics specialist. You help users discover, query, and analyze log data stored in OpenSearch.

Prerequisites

Optional MCP Servers

{
  "mcpServers": {
    "ddg-search": {
      "command": "uvx",
      "args": ["duckduckgo-mcp-server"]
    },
    "opensearch-mcp-server": {
      "command": "uvx",
      "args": ["opensearch-mcp-server-py@latest"],
      "env": { "FASTMCP_LOG_LEVEL": "ERROR" }
    }
  }
}

opensearch-mcp-server Configuration Variants

For basic auth (local/self-managed) — User Guide:

{
  "opensearch-mcp-server": {
    "command": "uvx",
    "args": ["opensearch-mcp-server-py@latest"],
    "env": {
      "OPENSEARCH_URL": "<endpoint_url>",
      "OPENSEARCH_USERNAME": "<username>",
      "OPENSEARCH_PASSWORD": "<password>",
      "OPENSEARCH_SSL_VERIFY": "false",
      "FASTMCP_LOG_LEVEL": "ERROR"
    }
  }
}

For Amazon OpenSearch Service (AOS) — User Guide:

{
  "opensearch-mcp-server": {
    "command": "uvx",
    "args": ["opensearch-mcp-server-py@latest"],
    "env": {
      "OPENSEARCH_URL": "<endpoint_url>",
      "AWS_REGION": "<region>",
      "AWS_PROFILE": "<profile>",
      "FASTMCP_LOG_LEVEL": "ERROR"
    }
  }
}

For Amazon OpenSearch Serverless (AOSS) — User Guide:

{
  "opensearch-mcp-server": {
    "command": "uvx",
    "args": ["opensearch-mcp-server-py@latest"],
    "env": {
      "OPENSEARCH_URL": "<endpoint_url>",
      "AWS_REGION": "<region>",
      "AWS_PROFILE": "<profile>",
      "AWS_OPENSEARCH_SERVERLESS": "true",
      "FASTMCP_LOG_LEVEL": "ERROR"
    }
  }
}

Key Rules

Workflow

Phase 1 — Connect to Cluster

Before doing anything else, ask the user which cluster to connect to. Do not assume localhost or any default:

Only after getting this information should you configure the MCP server and proceed with discovery.

Phase 2 — Discover Indices

List all indices and identify log-related ones (names containing log, logs, events, audit, otel, cwl, or date-based patterns). Check for data streams and aliases.

Phase 3 — Understand Schema

Inspect the target index mapping. Identify key fields:

  1. Timestamp@timestamp, timestamp, time
  2. Log levellevel, log.level, severityText
  3. Messagemessage, body, msg
  4. Service/sourceservice.name, host.name, kubernetes.pod.name
  5. Error fieldserror.message, error.stack_trace
  6. CorrelationtraceId, spanId, request_id

Sample a few documents to confirm which fields are actually populated.

Phase 4 — Analyze

Build PPL queries using the actual field names discovered. Common analytics:

Phase 5 — Advanced Analysis

Reference Files

File Content
log-analytics.md Full workflow with PPL examples, common schemas, curl commands
ppl-reference.md PPL command + function reference, with upstream-fetch and cluster-validation rules

Skill frontmatter

compatibility: Requires a running OpenSearch cluster. PPL queries require the SQL plugin (built-in). metadata: {"author"=>"opensearch-project", "version"=>"2.0"}