ELK Lab Exercises
ELK Lab Exercises
Exercise
Exercise 1:
1. Find all 404 status code responses with a response time greater than 1 second.
2. Find how many total documents are present in the index (clue: check under index
management)
Hints:
1. Go to Elastic IP as provided.
2. Go to "Discover" in the main menu
3. Select the index ‘web-logs’
Exercise 2:
1. Find all Samsung products that have "Smart" in their name and are currently in stock.
2. Find how many total documents are present in the index (clue: check under index
management)
Hints:
1. Go to "Discover" in the main menu
2. Select the "products*" index pattern
3. Set the time range to "Last 1 year" (or appropriate range)
Exercise 3:
1. Find all completed purchases that were paid using credit_card or paypal, but exclude transactions
from the US.
2. Find all refunds that were paid using credit_card or paypal, but exclude transactions from the US.
Hints:
1. Go to "Discover" in the main menu
2. Select the "transactions*" index pattern
OT Security CII SECEX-2025
Exercise 4:
1. Find all delivered orders
1. Filter for orders that contain at least one Electronics item
2. Filter for discounted orders AND orders with free shipping.
3. Look for delivered orders with more than 4 items
4. How many cancelled orders are there?
Hints:
1. Go to "Discover" in the main menu
2. Select the "orders*" index pattern
3. Set the time range to "Last 3 months" (or appropriate range)
Exercise: 5:
1. Find all instances where web servers in the production environment had CPU load above 90% in the
last 24 hours.
Hints:
1. Select the "system_metrics*" index pattern
2. Set the time range to "Last 7 days" (or appropriate range)
Exercise 6:
1. Create a KQL query to find high-priority tickets that took longer than 24 hours to resolve
2. Create a KQL query to identify trends in customer satisfaction across different teams and subscription
types
3. Create a visualization with:
a. X-axis: assigned_team
b. Y-axis: Average of customer_satisfaction
c. Split series by: subscription_type
Hints:
1. Go to Kibana "Discover" page
OT Security CII SECEX-2025
Exercise 7:
1. Create a KQL query to detect potential data exfiltration (large outbound data transfers)
2. Create a KQL query to identify suspicious connection patterns and security signatures
Hints:
1. Go to Kibana "Discover" page
2. Select the network_traffic index pattern
3. Source and destination should not be internal
4. Signature pattern detected will not be null
5. Destination ports for: RDP= 3389, SSH= 22
6. HTTP error codes numbers like 405, 500 etc. (400: client side issues, 500: server side issues)
OT Security CII SECEX-2025
Visualization Problems
Visualization 1: Create Visualizations for Support Tickets
a. Ticket Priority Distribution (Pie Chart) Navigate to Analytics → Visualize Library
click "Create visualization" Choose "Pie" visualization
b. Select the support_tickets index pattern Under "Metrics", verify "Count" is selected select
priority keyword
c. Set "Number of values" to 10 Click "Save and return"
d. Save as "Ticket Priority Distribution"
KQL
● Used in Kibana → Discover, Dashboards, Visualizations, Simple Rules
● Doesn't support joins or sequences
● Great for dashboards and reports
Examples:
● Errors from Apache logs:
log.level: "error" AND service.name: "apache" Use filters instead of
free text for performance.
● Use _exists_ for null checks.
● Combine conditions using: field1:value1 AND (field2:value2 OR field3:value3)
EQL
● Used in Elastic Security
● Designed for event correlation
OT Security CII SECEX-2025
What is Logstash?
● Ingests and transforms logs Plugins:
● Input: file, beats, tcp Filter: grok, mutate, geoip
Output: elasticsearch, stdout
Diagram:
● [file] → [grok filter] → [elasticsearch]
●
Grok Concept
OT Security CII SECEX-2025
input { file {
path => "/var/log/myapp.log" start_position =>
"beginning"
}
}
filter { grok {
match => {
"message" => "%{TIMESTAMP_ISO8601:timestamp} User login: %{USERNAME:user}
%{IP:ip}"
}
}
}
output { elasticsearch {
hosts => ["http://localhost:9200"] index =>
"myapp-logs"
}
}