AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a unified framework for interacting with Amazon OpenSearch Service (AOS) and OpenSearch Serverless (AOSS). It covers the full lifecycle of OpenSearch operations, including migration from legacy systems like Solr or Elasticsearch, infrastructure provisioning, advanced search implementation (including vector and RAG), and observability through log and trace analytics. It also features an Agentic AI Assistant for natural language data exploration and incident investigation, ensuring users can navigate complex cluster management and data analysis tasks without manual query crafting.
What it does
- Guides migration workflows from Solr, Elasticsearch, or self-managed OpenSearch to AOS/AOSS.
- Assists with provisioning, lifecycle management, and monitoring of domains and collections.
- Facilitates implementation of vector, semantic, and hybrid search, including RAG with Bedrock.
- Supports log and trace analytics using PPL, OpenTelemetry, and anomaly detection.
- Provides an Agentic AI Assistant for natural language querying and automated incident root cause analysis.
- Enforces operational best practices for sharding, storage tiering, and security configurations.
When to use it
- When planning a migration from legacy search engines to Amazon OpenSearch Service.
- When setting up or optimizing search capabilities, including vector search and RAG.
- When troubleshooting cluster health, performance, or shard allocation issues.
- When performing log or trace analysis to investigate system incidents.
- When you need to generate optimized PPL or DSL queries using natural language.
Advantages
- Centralizes complex operational knowledge across six distinct OpenSearch capabilities.
- Reduces manual query complexity by leveraging the Agentic AI Assistant.
- Provides clear, actionable guidance on production failure modes and migration blockers.
- Standardizes interactions through consistent CLI and data-plane patterns.
- Promotes architectural best practices for scaling and cost-effective storage tiering.
Usage examples
- “How do I migrate my existing Solr index to Amazon OpenSearch Service?”
- The agent identifies the migration capability, explains that Solr to OpenSearch is a refactor migration, and guides you through using the Migration Assistant for data backfill.
- “Why is my cluster status yellow and how can I fix it?”
- The agent uses the AI Assistant capability to analyze cluster health, check shard allocation, and provide specific commands or steps to resolve unassigned shards.
- “Help me set up a RAG pipeline using Bedrock and my OpenSearch domain.”
- The agent routes to the search capability, providing instructions on configuring Bedrock connectors and vector index mappings for semantic retrieval.
- “Find the root cause of the 503 errors in my application logs from the last hour.”
- The agent utilizes the AI Assistant to query logs, perform time-series analysis, and correlate findings to identify the likely root cause of the errors.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/aws/amazon-opensearch-service/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip amazon-opensearch-service.zip -d .agents/skills
Documentation by AWS
Amazon OpenSearch Service — the unified skill
This skill answers anything about Amazon OpenSearch Service or Serverless across six capabilities. Step 0 below routes the question to ONE capability and points at that capability's entry-point reference. Everything else — when to dispatch, sub-references, capability-specific facts, cross-capability links — lives in the entry-point reference for that capability.
AWS MCP server is recommended, not required. Capability references show standard AWS CLI commands as the primary syntax (e.g.,
aws opensearch describe-domain,aws opensearchserverless create-collection). Where the AWS MCP server is available, itscall_awstool offers a streamlined alternative — but every operation in this skill MUST work via the AWS CLI alone. Data-plane HTTP calls against AOS / AOSS useawscurlfor SigV4-signed requests; this works in both contexts.
Step 0: detect the capability — first thing you do
Pick one of the six capabilities below. State the detected capability in your first sentence (e.g., "Detected capability: SEARCH — semantic search setup with Bedrock embeddings."). Then load the entry-point reference; that file describes when to dispatch, indexes the rest of the capability's files, and routes you to the next step.
| Capability | Entry-point reference |
|---|---|
| migration — Solr / Elasticsearch / self-managed OpenSearch into AOS or AOSS. Schema/query translation, sizing, cutover. | references/assessment-workflow.md |
| provisioning — Provisioning and managing AOS domains and AOSS collections. Lifecycle, upgrades, storage tiers, FGAC, monitoring. | references/provisioning-reference.md |
| search — Vector / semantic / hybrid / sparse / dense / RAG retrieval. Bedrock connectors, FAISS HNSW vs Lucene. | references/search-semantic-search-guide.md |
| log-analytics — Log search, observability, PPL, OSI ingestion, anomaly detection, OpenSearch Dashboards. Splunk/Datadog/ELK alternatives. | references/log-analytics-guide.md |
| trace-analytics — Distributed traces with OpenTelemetry. Span queries, service maps, Data Prepper. | references/trace-analytics-trace-queries.md |
| ai-assistant — Agentic AI Assistant: auto-discovers indices, generates optimized PPL/DSL queries, summarizes results, and investigates incidents end-to-end. No manual query crafting needed. | references/ai-assistant.md |
If a prompt spans capabilities (e.g., "migrate from Solr AND set up RAG on the new domain"), pick the dominant capability for the response and close with a one-line handoff to the other capability's entry-point ref.
Universal rules (apply to ALL capabilities)
These rules apply to every response, regardless of capability. Capability-specific rules (sizing math, shape detection, Migration Assistant for Amazon OpenSearch Service capability matrix, k-NN engine selection) live in the entry-point references, not here.
Report header (every multi-section response). Begin every multi-section response with a single fenced metadata block:
> Generated: <ISO 8601 timestamp> | Skill: amazon-opensearch-service v<N>. Get the time by calling thecurrent_timetool (returns ISO 8601 in UTC). Read the skill version from this file's frontmatterversion:field. For one-line answers (terse FOCUSED_OPERATIONAL replies, anti-pattern refusals) the header is optional; for any multi-section deliverable it is REQUIRED. Place it immediately after the report title and before the first##heading.No dollar estimates (HARD CONSTRAINT). Never produce
$X/month,~$1,500, or any dollar figure. Route every cost question to https://calculator.aws and stop. If a sub-reference contains dollar figures, treat them as informational context only and do NOT pass them through to the user.No credential leakage (HARD CONSTRAINT). Never include master usernames, KMS key ARNs, VPC endpoint URLs, instance IPs, or account IDs in generated output.
Pick one for every A-vs-B decision. Name a primary recommendation in one line with a one-sentence reason. A "go with B if..." caveat is allowed AFTER the primary; never lead with conditional-only guidance.
Source restatement. The first 2–3 sentences must restate the source (engine + version + scale) when known, or restate the customer's question in concrete terms. The very first text the user sees must NOT be tool narration, meta-commentary, the report title, or simply restating the question verbatim.
No marketing tone. Do NOT use "seamless", "robust", "best-in-class", "production-hardened", "enterprise-grade", "world-class", "cleanly", "elegant". Do NOT stack 3+ vague hedges ("typically", "generally", "usually", "in most cases") in a single recommendation — be specific about when it does and does not apply.
Cross-capability handoff. When a user prompt spans capabilities (e.g., "migrate from Solr AND set up RAG on the new domain"), pick the dominant capability for the response, then close with a one-line handoff: "For <other capability>, see
references/<other-capability>-<entry>.md."
Cross-cutting references (used across multiple capabilities)
These references are not capability-prefixed because they apply across capabilities. Capability entry-point references load them when relevant; SKILL.md never loads them directly.
references/sizing.md— sizing math, instance family details, OR1 trade-offs, watermarks, JVM heap rules.references/vector-knn.md— k-NN engines, memory math, RAG ingestion patterns, ELSER alternatives.references/observability.md— log analytics patterns, ISM, UltraWarm/Cold tiering, Splunk/Datadog migration playbooks.references/security.md— FGAC, encryption, VPC patterns, audit logs, compliance posture.references/personas.md— communication style per persona.references/assessment-gotchas.md— production gotcha catalog (cite by number in Migration specifics or Risks/blockers tables; each gotcha carries aCategory:tag that determines its lane).references/assessment-knowledge-retrieval.md— topic → tool → URL recipe for batched verification.
Assets (assets/): report templates for FULL_ASSESSMENT renderings (Solr-source, ES-source, executive summary).
What this skill does NOT do
Estimate dollar costs. Pricing changes monthly and account-specific (RI, Savings Plan, EDP) discount math is outside this skill's reliable scope. Use https://calculator.aws.
Move data. Use Migration Assistant for Amazon OpenSearch Service (Historical Data Migration for backfill, Live Traffic Migration for live cutover).
Build embedding models. Use Amazon Bedrock or SageMaker.
Replace Splunk SPL or Datadog APM 1:1. Some queries / detectors / dashboards need rewriting.
Tune relevance for a specific catalog. Use OpenSearch Benchmark
big5workload + your own judgment list.
Guardrail — where this skill's own files live (MCP vs local install)
This skill can be loaded two ways, and they resolve the skill's own bundled files from different places. Determine how the skill was loaded before reading a reference or running a script:
Loaded through the AWS MCP server's
retrieve_skilltool: The skill is not installed on the local filesystem. You MUST fetch each reference or script viaretrieve_skillwith thefileparameter (e.g.file="references/architecture.md"orfile="scripts/deploy.py"), and run the script from the returned content. Do NOTfile_readthese paths locally — they do not exist on disk.Installed locally (e.g.
.kiro/skills/your-skill/or~/.claude/skills/your-skill/): Read and run files from the local skill directory using relative paths.
This distinction applies only to the skill's own packaged files. User data and
session artifacts are always read from and written to the user's working
directory. Never fetch or write customer data through retrieve_skill.
Files
- ATTRIBUTION.mdAdded by AutoGineer930 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md9.2 KiB
- assets/elasticsearch-gap-register.md5.1 KiB
- assets/elasticsearch-index-template-skeleton.md4.2 KiB
- assets/elasticsearch-report-template.md7.8 KiB
- assets/executive-summary-template.md3.0 KiB
- assets/report-template.md12.9 KiB
- assets/solr-gap-register.md3.8 KiB
- assets/solr-index-template-skeleton.md3.7 KiB
- assets/solr-report-template.md5.9 KiB
- assets/tech-deepdive-template.md6.2 KiB
- references/ai-assistant.md18.0 KiB
- references/assessment-gotchas.md17.1 KiB
- references/assessment-knowledge-retrieval.md9.3 KiB
- references/assessment-shape-anti-pattern-pushback.md10.4 KiB
- references/assessment-shape-comparative-decision.md12.9 KiB
- references/assessment-shape-focused-operational.md9.9 KiB
- references/assessment-shape-full-assessment.md20.7 KiB
- references/assessment-shape-overview.md12.1 KiB
- references/assessment-shape-schema-conversion.md8.9 KiB
- references/assessment-shape-sizing-only.md9.4 KiB
- references/assessment-shape-translation.md12.3 KiB
- references/assessment-workflow.md48.4 KiB
- references/compatibility-rubric.md5.9 KiB
- references/log-analytics-guide.md18.0 KiB
- references/log-analytics-osi-pipelines.md8.6 KiB
- references/log-analytics-troubleshooting.md1.6 KiB
- references/observability-ppl-reference.md15.1 KiB
- references/observability.md14.5 KiB
- references/personas.md10.4 KiB
- references/provisioning-agentic-setup.md4.8 KiB
- references/provisioning-domain-deploy-search.md2.2 KiB
- references/provisioning-domain-provision.md3.4 KiB
- references/provisioning-monitoring.md3.4 KiB
- references/provisioning-reference.md6.8 KiB
- references/provisioning-serverless-agentic-setup.md14.9 KiB
- references/provisioning-serverless-deploy-search.md6.7 KiB
- references/provisioning-serverless-deprovision.md4.0 KiB
- references/provisioning-serverless-provision.md8.8 KiB
- references/provisioning-storage-tiers.md2.1 KiB
- references/provisioning-troubleshooting.md8.0 KiB
- references/provisioning-upgrades.md5.4 KiB
- references/readiness-rubric.md3.4 KiB
- references/search-bedrock-connectors.md3.8 KiB
- references/search-dense-vector-models.md5.5 KiB
- references/search-document-processing-guide.md7.7 KiB
- references/search-evaluation-guide.md5.3 KiB
- references/search-index-config.md2.4 KiB
- references/search-recipes.md12.9 KiB
- references/search-semantic-search-guide.md18.2 KiB
- references/search-sparse-vector-models.md4.9 KiB
- references/search-troubleshooting.md1.9 KiB
- references/security.md9.3 KiB
- references/sizing.md12.2 KiB
- references/source-elasticsearch.md6.7 KiB
- references/source-opensearch.md4.8 KiB
- references/trace-analytics-trace-ingestion.md3.3 KiB
- references/trace-analytics-trace-queries.md13.9 KiB
- references/trace-analytics-troubleshooting.md1.6 KiB
- references/vector-knn.md12.9 KiB
references/log-analytics-guide.md
Log-analytics capability — entry point and guide
The AWS MCP server is recommended for executing these commands but is not required — all steps use standard
awscurl/ AWS CLI syntax.
This file is the entry point for the log-analytics capability. It covers log search at scale, observability, PPL queries, anomaly detection, OpenSearch Dashboards, alerting, and SIEM patterns — including replatforming from Splunk, Datadog, or self-managed ELK.
When to use this capability
SKILL.md routes here when the user is doing log analytics or observability on AOS / AOSS. Concrete triggers:
Phrases: "PPL query", "OpenSearch Dashboards", "ingest logs", "anomaly detection", "alerting rule", "Splunk replatform", "Datadog alternative", "OSI pipeline", "log search", "SIEM"
Tasks: query logs, set up OSI ingestion, configure ISM tiering / UltraWarm, build dashboards, define alerts, replatform a Splunk/Datadog/ELK stack
All log-analytics files (capability index)
| User need | File |
|---|---|
| Full log analytics workflow | this file |
| Set up OSI ingestion pipelines | log-analytics-osi-pipelines.md |
| Replatform from Splunk / Datadog / ELK | observability.md |
| Troubleshoot ingestion or query issues | log-analytics-troubleshooting.md |
Cross-cutting refs you may also load: observability.md (ISM / UltraWarm / Cold tiering details), security.md, personas.md.
Cross-capability handoff
For provisioning the OSI pipeline infra (CloudFormation, IAM, source connectors): see
provisioning-reference.md.For migrating an existing Splunk / Datadog / ELK stack: see
assessment-workflow.md(use the Splunk-replatform shape).For trace data on the same domain: see
trace-analytics-trace-queries.md.
Overview
This guide instructs you on how to perform log analytics against an existing OpenSearch domain or collection. The approach is discovery-first: understand what indices exist, learn the schema, sample the data, then build queries. Do not assume any particular index pattern or field names — discover them.
For the full PPL command and function catalog, see observability-ppl-reference.md.
Query discipline (MUST follow)
Unknown command → upstream grammar. If a PPL command or function is not in
observability-ppl-reference.md, or an emitted query fails with a syntax error, you MUST fetch the raw upstream doc fromopensearch-project/sqlunderdocs/user/ppl/before answering. You MUST NOT invent PPL syntax, because OpenSearch PPL has version-specific commands that do not exist in other query languages.Verify or disclose. When the domain/collection endpoint is reachable, you MUST validate every emitted query against
_plugins/_ppl; on 0 rows, fall back to_plugins/_ppl/_explainto confirm the plan and surface the empty result; on error, fix and re-validate. When no endpoint is reachable, you MUST state that the query is unverified, because an untested query can silently reference a non-existent field.Backtick-quote dotted fields. Field names containing a dot MUST be backtick-quoted (
`log.level`,`host.name`), because an unquoted dot is parsed as a path separator and silently resolves to a non-existent field.
Data Plane Access with awscurl
Use awscurl for SigV4-authenticated HTTP requests to AOS/AOSS endpoints.
Setup
pip install awscurlCredentials: source SigV4 signing credentials from an IAM role (instance profile, ECS task role, or an SSO session) rather than static access keys, and keep endpoints and other config in AWS Secrets Manager or SSM Parameter Store rather than hardcoding them.
Environment Variables
| Variable | Example | Description |
|---|---|---|
OPENSEARCH_ENDPOINT | https://my-domain.us-east-1.es.amazonaws.com | AOS domain or AOSS collection endpoint |
AWS_REGION | us-east-1 | AWS region |
AWS_PROFILE | default | AWS CLI profile (optional) |
Base Commands
AOS (managed domains):
awscurl --service es --region $AWS_REGION \
-X POST "$OPENSEARCH_ENDPOINT/_plugins/_ppl" \
-H 'Content-Type: application/json' \
-d '{"query": "<PPL_QUERY>"}'AOSS (serverless collections):
awscurl --service aoss --region $AWS_REGION \
-X POST "$OPENSEARCH_ENDPOINT/_plugins/_ppl" \
-H 'Content-Type: application/json' \
-d '{"query": "<PPL_QUERY>"}'Use
--service esfor AOS domains,--service aossfor AOSS collections.
Security Considerations
Verify domain/collection encryption at rest is enabled before ingesting sensitive data
Use fine-grained access control (FGAC) to restrict index and field-level access
Do not ingest PII or credentials without field-level encryption or masking
Apply data retention policies via ISM to comply with regulatory requirements
Enable CloudTrail logging to audit control plane API calls, and enable OpenSearch audit logs to track data plane operations (queries, indexing) for compliance
Connecting to the Domain/Collection
Determine the domain or collection type and endpoint using the AWS CLI (or call_aws if the AWS MCP server is available):
If the user names a domain:
aws opensearch describe-domain --domain-name <name>→ extractEndpointandARN(region from ARN). With AWS MCP:call_aws opensearch describe-domain.If the user names a collection:
aws opensearchserverless batch-get-collection --names <name>→ extractcollectionEndpoint. With AWS MCP:call_aws opensearchserverless batch-get-collection.If unclear: list with
aws opensearch list-domain-namesoraws opensearchserverless list-collections
This is important because the connection method, authentication, and available features differ between AOS domains and AOSS collections.
Phase 1 — Discover Available Indices
AOSS Note: OpenSearch Serverless does not support
_catAPIs. Use--service aossinstead of--service esfor all AOSS requests. For index discovery on AOSS, use PPL:source = * | stats count() by index.
Before writing any query, find out what log indices exist on the domain or collection.
List All Indices
awscurl --service es --region $AWS_REGION \
"$OPENSEARCH_ENDPOINT/_cat/indices?format=json&h=index,health,docs.count,store.size&s=docs.count:desc"Look for indices that suggest logs: names containing log, logs, events, audit, access, syslog, otel, cwl (CloudWatch Logs), or date-based patterns like logs-2024.01.15.
List Index Patterns with Aliases
awscurl --service es --region $AWS_REGION \
"$OPENSEARCH_ENDPOINT/_cat/aliases?format=json&h=alias,index&s=alias"Check Data Streams
awscurl --service es --region $AWS_REGION \
"$OPENSEARCH_ENDPOINT/_data_stream"After discovering indices, ask the user which index or index pattern they want to analyze if it's not obvious. If there are multiple log indices, ask about the relationship between them (e.g., are they daily rollover indices for the same data? different applications? different log levels?).
Phase 2 — Understand the Schema
Once you know the target index pattern, inspect its mapping to learn the available fields.
Get Index Mapping
awscurl --service es --region $AWS_REGION \
"$OPENSEARCH_ENDPOINT/<INDEX_PATTERN>/_mapping"Via PPL:
awscurl --service es --region $AWS_REGION \
-X POST "$OPENSEARCH_ENDPOINT/_plugins/_ppl" \
-H 'Content-Type: application/json' \
-d '{"query": "describe <INDEX_NAME>"}'Use a concrete index name (e.g.,
logs-2024.01.15) fordescribe, not a wildcard pattern.
Identify Key Fields
From the mapping, identify:
Timestamp field — usually
@timestamp,timestamp,time, orevent.createdLog level field —
level,log.level,severity,severityText,loglevelMessage field —
message,msg,body,log,event.originalService/source field —
service,service.name,host.name,source,kubernetes.pod.name,resource.attributes.service.nameError fields —
error.message,error.stack_trace,exception.typeCorrelation fields —
traceId,trace_id,spanId,request_id,correlation_id
If the mapping is large or unclear, ask the user: "I see fields like X, Y, Z — which field contains the log message? Which one is the log level?"
Sample Documents
Always look at a few real documents to understand the actual data shape — mappings alone can be misleading (e.g., dynamic fields, nested objects, multi-value fields):
Via PPL:
awscurl --service es --region $AWS_REGION \
-X POST "$OPENSEARCH_ENDPOINT/_plugins/_ppl" \
-H 'Content-Type: application/json' \
-d '{"query": "source=<INDEX_PATTERN> | head 5"}'Review the sample documents to confirm:
Which fields are actually populated (vs defined but empty)
The format of timestamps, log levels, and messages
Whether the message field is structured JSON or free-text
Whether there are nested objects that need backtick-quoting in PPL
Phase 3 — Ask Clarifying Questions (If Needed)
If the schema is not self-explanatory, ask the user:
"What does this index contain? Application logs, access logs, audit logs?"
"I see multiple log indices (X, Y, Z) — are these from different services or different time periods?"
"The message field appears to contain JSON — should I parse specific fields from it?"
"I see a
trace_idfield — do you want to correlate logs with traces?""What time range are you interested in?"
Do not skip this step if the data is ambiguous. Getting the schema right upfront saves failed queries later.
Phase 4 — Perform Analytics
With the schema understood, build PPL queries using the actual field names discovered above. All examples below use placeholder field names — substitute with the real ones.
Running PPL Queries
awscurl --service es --region $AWS_REGION \
-X POST "$OPENSEARCH_ENDPOINT/_plugins/_ppl" \
-H 'Content-Type: application/json' \
-d '{"query": "<PPL_QUERY>"}'For AOSS, use
--service aossinstead of--service es.
Log Volume Over Time
source=<INDEX_PATTERN> | stats count() as volume by span(<TIMESTAMP_FIELD>, 1h)Error Count by Service
source=<INDEX_PATTERN> | where <LEVEL_FIELD> = 'ERROR' | stats count() as errors by <SERVICE_FIELD> | sort - errorsError Rate Trend
source=<INDEX_PATTERN> | stats count() as total, sum(case(<LEVEL_FIELD> = 'ERROR', 1 else 0)) as errors by span(<TIMESTAMP_FIELD>, 1h)Recent Errors
source=<INDEX_PATTERN> | where <LEVEL_FIELD> = 'ERROR' | fields <TIMESTAMP_FIELD>, <SERVICE_FIELD>, <MESSAGE_FIELD> | sort - <TIMESTAMP_FIELD> | head 20Full-Text Search
source=<INDEX_PATTERN> | where match(<MESSAGE_FIELD>, 'connection timeout') | sort - <TIMESTAMP_FIELD> | head 20Top Error Messages
source=<INDEX_PATTERN> | where <LEVEL_FIELD> = 'ERROR' | top 10 <MESSAGE_FIELD>Rare Error Messages
source=<INDEX_PATTERN> | where <LEVEL_FIELD> = 'ERROR' | rare <MESSAGE_FIELD>Log Pattern Discovery
Automatically cluster similar log messages:
source=<INDEX_PATTERN> | where <LEVEL_FIELD> = 'ERROR' | patterns <MESSAGE_FIELD> | fields <MESSAGE_FIELD>, patterns_field | head 30Error Breakdown by Level and Service
source=<INDEX_PATTERN> | stats count() by <LEVEL_FIELD>, <SERVICE_FIELD>Time-Filtered Queries
source=<INDEX_PATTERN> | where <TIMESTAMP_FIELD> > DATE_SUB(NOW(), INTERVAL 1 HOUR) | stats count() by <LEVEL_FIELD>Unique Services/Hosts
source=<INDEX_PATTERN> | stats distinct_count(<SERVICE_FIELD>) as services, distinct_count(<HOST_FIELD>) as hostsLatency from Structured Logs
If logs contain a duration/latency field:
source=<INDEX_PATTERN> | stats avg(<DURATION_FIELD>) as avg_ms, percentile(<DURATION_FIELD>, 95) as p95_ms, percentile(<DURATION_FIELD>, 99) as p99_ms by <SERVICE_FIELD>Extract Fields from Unstructured Messages
If the message field contains unstructured text, use grok or parse to extract fields:
source=<INDEX_PATTERN> | grok <MESSAGE_FIELD> '%{IP:client_ip} %{WORD:method} %{URIPATHPARAM:path} %{NUMBER:status}' | stats count() by statusCaveat:
grokprocesses all matching rows in memory. Add| head Nbeforegrokon large indices to avoid resource errors.
Phase 5 — Advanced Analysis
Cross-Index Correlation
If logs span multiple indices (e.g., application logs + access logs), correlate using shared fields like request_id, trace_id, or timestamp proximity:
Step 1 — Find an event of interest in one index:
source=<APP_LOGS> | where <LEVEL_FIELD> = 'ERROR' | fields <CORRELATION_FIELD>, <TIMESTAMP_FIELD>, <MESSAGE_FIELD> | head 10Step 2 — Look up the same correlation ID in the other index:
source=<ACCESS_LOGS> | where <CORRELATION_FIELD> = '<VALUE>' | fields <TIMESTAMP_FIELD>, <MESSAGE_FIELD>Anomaly Detection
Use PPL's built-in anomaly detection on numeric fields (e.g., log volume, error count):
source=<INDEX_PATTERN> | stats count() as volume by span(<TIMESTAMP_FIELD>, 5m) | ad time_field=<TIMESTAMP_FIELD>The
adcommand auto-detects input fields from the pipeline. It works best on time-series data with regular intervals.
Query DSL for Complex Aggregations
For queries that PPL doesn't support well (nested aggregations, scripted fields), fall back to Query DSL:
awscurl --service es --region $AWS_REGION \
-X POST "$OPENSEARCH_ENDPOINT/<INDEX_PATTERN>/_search" \
-H 'Content-Type: application/json' \
-d '{
"size": 0,
"query": {
"bool": {
"must": [{"match": {"<LEVEL_FIELD>": "ERROR"}}],
"filter": [{"range": {"<TIMESTAMP_FIELD>": {"gte": "now-1h"}}}]
}
},
"aggs": {
"by_service": {
"terms": {"field": "<SERVICE_FIELD>", "size": 20},
"aggs": {
"over_time": {
"date_histogram": {"field": "<TIMESTAMP_FIELD>", "fixed_interval": "5m"}
}
}
}
}
}'Common Log Schemas Reference
When you encounter these common schemas, use the field mappings below:
Elastic Common Schema (ECS)
Timestamp: @timestamp, Level: log.level, Message: message, Service: service.name, Host: host.name, Error: error.message
OTel Logs (logs-otel-v1-*)
Timestamp: @timestamp, Level: severityText, Message: body, Service: `resource.attributes.service.name` (backtick-quoted), Trace: traceId, Span: spanId
Simple JSON Logs
Timestamp: timestamp or @timestamp, Level: level, Message: message or msg, Service: service, Host: host
Syslog
Timestamp: @timestamp, Level: severity, Message: message, Host: host, Program: program, Facility: facility
Apache/Nginx Access Logs
Client: clientip, Request: request, Status: response, Bytes: bytes, Method: verb, Agent: agent
Key PPL Tips for Log Analytics
Always backtick-quote dotted field names:
`log.level`,`host.name`Use
head Nbefore memory-intensive commands (grok,streamstats,eventstats)Use
span(<timestamp>, <interval>)for time bucketing — common intervals:5m,15m,1h,1dUse
match()for full-text search,likefor wildcard patterns,match_phrase()for exact phrasesUse
patternsfor automatic log message clusteringUse
dedupto find unique error messages:dedup <MESSAGE_FIELD> | fields <MESSAGE_FIELD>
Index Management with awscurl
Create Log Index with Mappings
awscurl --service es --region $AWS_REGION \
-X PUT "$OPENSEARCH_ENDPOINT/application-logs" \
-H 'Content-Type: application/json' \
-d '{
"settings": {"number_of_shards": 1, "number_of_replicas": 1},
"mappings": {
"properties": {
"@timestamp": {"type": "date"},
"level": {"type": "keyword"},
"message": {"type": "text"},
"service": {"type": "keyword"},
"trace_id": {"type": "keyword"}
}
}
}'Bulk Index Log Documents
awscurl --service es --region $AWS_REGION \
-X POST "$OPENSEARCH_ENDPOINT/_bulk" \
-H 'Content-Type: application/x-ndjson' \
-d '{"index": {"_index": "application-logs"}}
{"@timestamp": "2024-01-15T10:30:00Z", "level": "ERROR", "message": "Connection timeout to database", "service": "order-service"}
{"index": {"_index": "application-logs"}}
{"@timestamp": "2024-01-15T10:30:05Z", "level": "INFO", "message": "Retry succeeded", "service": "order-service"}
'Create ISM Policy for Log Rotation
awscurl --service es --region $AWS_REGION \
-X PUT "$OPENSEARCH_ENDPOINT/_plugins/_ism/policies/log-rotation-policy" \
-H 'Content-Type: application/json' \
-d '{
"policy": {
"description": "Hot-warm-delete lifecycle for logs",
"default_state": "hot",
"states": [
{"name": "hot", "actions": [], "transitions": [{"state_name": "warm", "conditions": {"min_index_age": "7d"}}]},
{"name": "warm", "actions": [{"read_only": {}}], "transitions": [{"state_name": "delete", "conditions": {"min_index_age": "30d"}}]},
{"name": "delete", "actions": [{"delete": {}}], "transitions": []}
],
"ism_template": [{"index_patterns": ["application-logs*"], "priority": 100}]
}
}'Create Data Stream for Time-Series Logs
# Create index template for data stream
awscurl --service es --region $AWS_REGION \
-X PUT "$OPENSEARCH_ENDPOINT/_index_template/logs-template" \
-H 'Content-Type: application/json' \
-d '{
"index_patterns": ["logs-*"],
"data_stream": {},
"template": {
"settings": {"number_of_shards": 1},
"mappings": {
"properties": {
"@timestamp": {"type": "date"},
"message": {"type": "text"},
"level": {"type": "keyword"}
}
}
}
}'
# Create the data stream
awscurl --service es --region $AWS_REGION \
-X PUT "$OPENSEARCH_ENDPOINT/_data_stream/logs-stream"Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- AWS
- Publisher
- AWS (Official)
- Source
- aws/agent-toolkit-for-aws · plugins/aws-data-analytics/skills/amazon-opensearch-service · commit 0a218f8
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- aws/agent-toolkit-for-aws
AutoGineer is not affiliated with or endorsed by AWS.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download amazon-opensearch-service.zip