elasticsearch-analysis

Analyze Elasticsearch and OpenSearch logs using statistics-first investigation and Lucene queries.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/erwinv2k-TKG/AgentesVSC --skill elasticsearch-analysis-erwinv2k-tkg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: elasticsearch-analysis
Source: https://github.com/erwinv2k-TKG/AgentesVSC/tree/main/packs/incidentfox/sre-agent/.claude/skills/observability-elasticsearch
Command: npx skills add https://github.com/erwinv2k-TKG/AgentesVSC --skill elasticsearch-analysis-erwinv2k-tkg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires httpx, and includes scripts (resource) components.

What problem does it solve? Investigating production incidents in Elasticsearch or OpenSearch often leads to dumping raw logs, which is slow and overwhelming. This Skill enforces a statistics-first workflow so you understand log volume, error rates, and top error patterns before sampling any individual log entries. ## Core Features & Use Cases - Statistics-First Investigation: The get_statistics.py script reports total log count, error rate, level distribution, top services, and normalized top error patterns with an actionable recommendation. - Strategic Log Sampling: The sample_logs.py script supports errors_only, warnings_up, around_time, and all strategies to fetch only relevant logs within bounded time ranges. - Query Reference: Built-in guidance for Lucene query syntax and Query DSL, including bool queries, aggregations, and keyword vs text field handling. - Use Case: During an incident, run get_statistics.py against logs-production to see a 12% error rate concentrated in one service, then sample errors around the spike timestamp to identify the root cause pattern. ## Quick Start Ask the agent to investigate errors in the logs-production Elasticsearch index over the last hour, starting with overall statistics and then sampling the top error patterns.

Frequently Asked Questions about elasticsearch-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I investigate errors in Elasticsearch logs?

Start with get_statistics.py to get total count, error rate, and top error patterns for your index and time range. Then use sample_logs.py with the errors_only strategy to inspect representative error entries, or around_time to examine logs near an anomaly timestamp.

How to query Elasticsearch logs with Lucene syntax?

Lucene supports field queries like level:ERROR, wildcards like host:web-*, ranges like status:[400 TO 599], and boolean operators such as AND, OR, and NOT with grouping. Use phrase search with quotes for exact multi-word matches like "connection refused".

Does this work with OpenSearch and Elastic Cloud?

Yes, the client works with Elasticsearch 7.x, 8.x, 9.x, and OpenSearch via the REST API. It supports API key authentication for Elastic Cloud, basic auth, bearer tokens, and a proxy mode where credentials are injected by tenant context.

Why should I not fetch raw logs directly from Elasticsearch?

Unbounded raw log fetches are slow and hide the big picture. The statistics-first approach reveals volume, error rate, and dominant patterns so you can choose a targeted sampling strategy instead of scrolling through thousands of irrelevant entries.

Why do Elasticsearch term aggregations return no results on message fields?

Text fields are analyzed for full-text search and cannot be aggregated directly. Use the .keyword sub-field, such as service.keyword or message.keyword, for terms aggregations, and reserve plain text fields for match queries.