Skip to main content

obz-opensearch

OpenSearch provider for obz. Supports log search and trace operations using Lucene-based query syntax. Requires --index flag. This skill should be used when the user mentions "OpenSearch", "obz -p os", or needs to search logs or traces from an OpenSearch cluster.

Source facts

Repository
alibaba/obz-cli
Last source activity
April 29, 2026 at 07:18
Detected SKILL.md language
English
Stars
27
Forks
9

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
obz-opensearch
description
OpenSearch provider for obz. Supports log search and trace operations using Lucene-based query syntax. Requires --index flag. This skill should be used when the user mentions "OpenSearch", "obz -p os", or needs to search logs or traces from an OpenSearch cluster.
# obz-opensearch: OpenSearch Provider ## Quick Reference | Field | Value | |------------------|----------------------------------------------------| | Aliases | `os`, `opensearch` | | Signals | Log, Trace | | Query language | OpenSearch DSL (Lucene-based query string) | | Auth | Basic auth or bearer token (in config.yaml) | | Provider flags | `--index` (required at runtime) | | Supported cmds | log search, trace search, trace get | ## Supported Commands ``` obz log search # Search log entries in an OpenSearch index obz trace search # Search trace spans in an OpenSearch index obz trace get # Retrieve a trace by ID from OpenSearch ``` ## Provider-Specific Flags | Flag | Type | Required | Description | |-------------|--------|----------|------------------------------------------| | `--index` | String | Yes | Index name or pattern to query | The `--index` flag is declared optional at the clap level (so other providers don't error), but OpenSearch enforces it at runtime. Omitting it will produce a clear error message. ## Authentication Configure auth in `config.yaml` under `providers.<name>.auth`. Supports either basic auth or bearer token. **Basic auth**: ```yaml # config.yaml providers: os: endpoint: https://opensearch.example.com index: logs-* auth: username: admin password: ${env:OS_PASS} ``` **Bearer token**: ```yaml providers: os: endpoint: https://opensearch.example.com index: logs-* auth: token: ${env:OS_TOKEN} ``` Then query with just `-p`: ```bash obz log search -p os -q 'level:ERROR' --from now-1h ``` ## Query Language OpenSearch accepts Lucene-based query strings in the `-q` parameter. ### Common Patterns ``` level:ERROR # field match level:ERROR AND service:api # boolean AND status:(404 OR 500) # grouped OR message:"connection refused" # phrase match host:web-* AND NOT path:/health # wildcards and negation response_time:[500 TO *] # range query ``` ### Tips - Field names are case-sensitive and must match your index mapping. - Use double quotes for exact phrase matches. - Wildcards (`*`, `?`) work in field values but not at the start of a term by default (it's expensive). ## Examples **Search logs by level**: ```bash obz log search -p os --index 'logs-*' -q 'level:ERROR' --from now-1h ``` **Search with boolean operators**: ```bash obz log search -p os --index 'app-logs' \ -q 'service:api AND status:500' --from now-6h ``` **Search traces**: ```bash obz trace search -p os --index 'traces-*' -q 'service:frontend' --from now-1h ``` **Retrieve a specific trace**: ```bash obz trace get -p os --index 'traces-*' abc123def456 ```
View on GitHub