elasticsearch-audit▌
elastic/agent-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Enable and configure security audit logging for Elasticsearch via the cluster settings API. Audit logs record security
- ›events such as authentication attempts, access grants and denials, role changes, and API key operations — essential for
- ›compliance and incident investigation.
Elasticsearch Audit Logging
Enable and configure security audit logging for Elasticsearch via the cluster settings API. Audit logs record security events such as authentication attempts, access grants and denials, role changes, and API key operations — essential for compliance and incident investigation.
For Kibana audit logging (saved object access, login/logout, space operations), see kibana-audit. For authentication and API key management, see elasticsearch-authn. For roles and user management, see elasticsearch-authz. For diagnosing security errors, see elasticsearch-security-troubleshooting.
For detailed API endpoints and event types, see references/api-reference.md.
Deployment note: Audit logging configuration differs across deployment types. See Deployment Compatibility for details.
Jobs to Be Done
- Enable or disable security audit logging on a cluster
- Select which security events to record (authentication, access, config changes)
- Create filter policies to reduce audit log noise
- Query audit logs for failed authentication attempts
- Investigate unauthorized access or privilege escalation incidents
- Set up compliance-focused audit configuration
- Detect brute-force login patterns from audit data
- Configure audit output to an index for programmatic querying
Prerequisites
| Item | Description |
|---|---|
| Elasticsearch URL | Cluster endpoint (e.g. https://localhost:9200 or a Cloud deployment URL) |
| Authentication | Valid credentials (see the elasticsearch-authn skill) |
| Cluster privileges | manage cluster privilege to update cluster settings |
| License | Audit logging requires a gold, platinum, enterprise, or trial license |
Prompt the user for any missing values.
Enable Audit Logging
Enable audit logging dynamically without a restart:
curl -X PUT "${ELASTICSEARCH_URL}/_cluster/settings" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"persistent": {
"xpack.security.audit.enabled": true
}
}'
To disable, set xpack.security.audit.enabled to false. Verify current state:
curl "${ELASTICSEARCH_URL}/_cluster/settings?include_defaults=true&flat_settings=true" \
<auth_flags> | jq '.defaults | with_entries(select(.key | startswith("xpack.security.audit")))'
Audit Output
Audit events can be written to two outputs. Both can be active simultaneously.
| Output | Setting value | Description |
|---|---|---|
| logfile | logfile |
Written to <ES_HOME>/logs/<cluster>_audit.json. Default. |
| index | index |
Written to .security-audit-* indices. Queryable via the API. |
Configure output via API
curl -X PUT "${ELASTICSEARCH_URL}/_cluster/settings" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"persistent": {
"xpack.security.audit.enabled": true,
"xpack.security.audit.outputs": ["index", "logfile"]
}
}'
The index output is required for programmatic querying of audit events. The logfile output is useful for shipping to
external SIEM tools via Filebeat.
Note: On self-managed clusters,
xpack.security.audit.outputsmay require a static setting inelasticsearch.ymlon older versions (pre-8.x). On 8.x+, prefer the cluster settings API.
Select Events to Record
Control which event types are included or excluded. By default, all events are recorded when audit is enabled.
Include specific events only
curl -X PUT "${ELASTICSEARCH_URL}/_cluster/settings" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"persistent": {
"xpack.security.audit.logfile.events.include": [
"authentication_failed",
"access_denied",
"access_granted",
"anonymous_access_denied",
"tampered_request",
"run_as_denied",
"connection_denied"
]
}
}'
Exclude noisy events
curl -X PUT "${ELASTICSEARCH_URL}/_cluster/settings" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"persistent": {
"xpack.security.audit.logfile.events.exclude": [
"access_granted"
]
}
}'
Excluding access_granted significantly reduces log volume on busy clusters — use this when only failures matter.
Event types reference
| Event | Fires when |
|---|---|
authentication_failed |
Credentials were rejected |
authentication_success |
User authenticated successfully |
access_granted |
An authorized action was performed |
access_denied |
An action was denied due to insufficient privileges |
anonymous_access_denied |
An unauthenticated request was rejected |
tampered_request |
A request was detected as tampered with |
connection_granted |
A node joined the cluster (transport layer) |
connection_denied |
A node connection was rejected |
run_as_granted |
A run-as impersonation was authorized |
run_as_denied |
A run-as impersonation was denied |
security_config_change |
A security setting was changed (role, user, API key, etc.) |
See references/api-reference.md for the complete event type list with field details.
Filter Policies
Filter policies let you suppress specific audit events by user, realm, role, or index without disabling the event type globally. Multiple policies can be active — an event is logged only if no policy filters it out.
Ignore system and internal users
curl -X PUT "${ELASTICSEARCH_URL}/_cluster/settings" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"persistent": {
"xpack.security.audit.logfile.events.ignore_filters": {
"system_users": {
"users": ["_xpack_security", "_xpack", "elastic/fleet-server"],
"realms": ["_service_account"]
}
}
}
}'
Ignore health-check traffic on specific indices
curl -X PUT "${ELASTICSEARCH_URL}/_cluster/settings" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"persistent": {
"xpack.security.audit.logfile.events.ignore_filters": {
"health_checks": {
"users": ["monitoring-user"],
"indices": [".monitoring-*"]
}
}
}
}'
Filter policy fields
| Field | Type | Description |
|---|---|---|
users |
array[string] | Usernames to exclude (supports wildcards) |
realms |
array[string] | Realm names to exclude |
roles |
array[string] | Role names to exclude |
indices |
array[string] | Index names or patterns to exclude (supports *) |
actions |
array[string] | Action names to exclude (e.g. indices:data/read/*) |
An event is filtered out if it matches all specified fields within a single policy.
Remove a filter policy
Set the policy to null:
curl -X PUT "${ELASTICSEARCH_URL}/_cluster/settings" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"persistent": {
"xpack.security.audit.logfile.events.ignore_filters.health_checks": null
}
}'
Query Audit Events
When the index output is enabled, audit events are stored in .security-audit-* indices and can be queried.
Search for failed authentication attempts
curl -X POST "${ELASTICSEARCH_URL}/.security-audit-*/_search" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"query": {
"bool": {
"filter": [
{ "term": { "event.action": "authentication_failed" } },
{ "range": { "@timestamp": { "gte": "now-24h" } } }
]
}
},
"sort": [{ "@timestamp": { "order": "desc" } }],
"size": 50
}'
Search for access denied events on a specific index
curl -X POST "${ELASTICSEARCH_URL}/.security-audit-*/_search" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"query": {
"bool": {
"filter": [
{ "term": { "event.action": "access_denied" } },
{ "term": { "indices": "logs-*" } },
{ "range": { "@timestamp": { "gte": "now-7d" } } }
]
}
},
"sort": [{ "@timestamp": { "order": "desc" } }],
"size": 20
}'
Search for security configuration changes
curl -X POST "${ELASTICSEARCH_URL}/.security-audit-*/_search" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"query": {
"bool": {
"filter": [
{ "term": { "event.action": "security_config_change" } },
{ "range": { "@timestamp": { "gte": "now-7d" } } }
]
}
},
"sort": [{ "@timestamp": { "order": "desc" } }],
"size": 50
}'
This captures role creation/deletion, user changes, API key operations, and role mapping updates.
Count events by type and detect brute-force patterns
Use terms aggregations on event.action (with size: 0) to count events by type over a time window. To detect
brute-force attempts, aggregate authentication_failed events by source.ip<
How to use elasticsearch-audit on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add elasticsearch-audit
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches elasticsearch-audit from GitHub repository elastic/agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate elasticsearch-audit. Access the skill through slash commands (e.g., /elasticsearch-audit) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★37 reviews- ★★★★★Rahul Santra· Dec 24, 2024
elasticsearch-audit reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Kofi Harris· Dec 8, 2024
We added elasticsearch-audit from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Dev Dixit· Dec 4, 2024
elasticsearch-audit has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Arya Rahman· Nov 27, 2024
Solid pick for teams standardizing on skills: elasticsearch-audit is focused, and the summary matches what you get after install.
- ★★★★★Aisha Haddad· Nov 23, 2024
elasticsearch-audit fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Pratham Ware· Nov 15, 2024
I recommend elasticsearch-audit for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Anika Nasser· Nov 11, 2024
elasticsearch-audit is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Kofi White· Oct 14, 2024
We added elasticsearch-audit from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Yash Thakker· Oct 6, 2024
Useful defaults in elasticsearch-audit — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Zaid Patel· Oct 2, 2024
Keeps context tight: elasticsearch-audit is the kind of skill you can hand to a new teammate without a long onboarding doc.
showing 1-10 of 37