Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Audit Logging Setup in Elasticsearch
📖 Scenario: You are a system administrator responsible for securing an Elasticsearch cluster. To track all user actions for security and compliance, you need to enable audit logging. Audit logs will record who accessed the system and what actions they performed.
🎯 Goal: Enable audit logging in Elasticsearch by creating the initial configuration, setting the audit log outputs, and verifying that audit logs are generated correctly.
📋 What You'll Learn
Create the initial audit logging configuration in elasticsearch.yml
Add a setting to specify the audit log output file path
Enable audit logging for authentication and access events
Verify audit logs are generated by checking the log output
💡 Why This Matters
🌍 Real World
Audit logging helps organizations track user actions and detect unauthorized access in Elasticsearch clusters.
💼 Career
Security engineers and DevOps professionals use audit logging to meet compliance requirements and improve system security.
Progress0 / 4 steps
1
Create initial audit logging configuration
In the elasticsearch.yml file, add the setting xpack.security.audit.enabled: true to enable audit logging.
Elasticsearch
Hint
This setting turns on audit logging in Elasticsearch.
2
Configure audit log output file
In the elasticsearch.yml file, add the setting xpack.security.audit.outputs: ["logfile"] to specify audit logs should be written to a log file.
Elasticsearch
Hint
This setting tells Elasticsearch to write audit logs to the log file.
3
Enable audit logging for authentication and access events
In the elasticsearch.yml file, add the setting xpack.security.audit.logfile.events.include: ["authentication_success", "access_granted"] to log successful authentication and access events.
Elasticsearch
Hint
This setting ensures audit logs capture important security events.
4
Verify audit logs are generated
Run the command tail -n 5 /var/log/elasticsearch/elasticsearch_audit.log to display the last 5 lines of the audit log file and verify audit logs are being recorded.
Elasticsearch
Hint
This command shows recent audit log entries. You should see entries related to authentication and access.
Practice
(1/5)
1. What is the main purpose of audit logging in Elasticsearch?
easy
A. To record user actions and security events
B. To improve search speed
C. To backup data automatically
D. To monitor cluster health
Solution
Step 1: Understand audit logging function
Audit logging tracks what users do and records security-related events.
Step 2: Compare with other options
Improving search speed, backing up data, or monitoring cluster health are different Elasticsearch features.
Final Answer:
To record user actions and security events -> Option A
Quick Check:
Audit logging = record user actions [OK]
Hint: Audit logging tracks user and security events only [OK]
Common Mistakes:
Confusing audit logging with backup or monitoring
Thinking it speeds up search queries
Assuming it manages cluster health
2. Which setting enables audit logging in Elasticsearch's configuration file?
easy
A. security.audit.log: on
B. xpack.security.audit.enabled: true
C. audit.logging.enabled: yes
D. xpack.audit.security: enabled
Solution
Step 1: Identify correct setting syntax
The official setting to enable audit logging is xpack.security.audit.enabled set to true.
Step 2: Check other options for correctness
Other options use incorrect keys or values not recognized by Elasticsearch.