Introduction To Logging With The Elk Stack
Introduction To Logging With The Elk Stack
Amy Ghate
Solutions Architect
1
+
=
+ ObservaBLT
Observability
2
Elastic Approach to Observability
3
Agenda
Things we're going to cover
4
Agenda
Challenges with log analytics
5
Logs for one host or app
This is fairly straightforward
$ > tail -f /var/log/messages
7
8
Immediate needs for log analytics
What's missing from the previous desktop
9
Agenda
Things we're going to cover
10
We're running in Elastic Cloud
Works the same in the cloud or running the default distribution
11
Click on the Logging Button
Works the same in the cloud or running the default distribution
12
Many choices
We're going to ingest the System logs
13
Detailed instructions
Context-aware instructions for cloud or on-prem installs
14
Getting Started
Cloud or on-prem installs
15
Steps
Download and install Filebeat
$ >curl -LO --silent \
https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.5.0-darwin-x86_64.tar.gz
16
Steps
Edit the configuration
17
Configuration
Cloud aware - using superuser
18
Edit the configuration
Copy the snippet, paste in the password
cloud.id: "Sandbox:dXMtY2VudHJ..."
cloud.auth: "elastic:long-random-password" # because we are using Elastic Cloud
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"] ← If we were not using Elastic Cloud
#username: "elastic" ←
#password: "long-random-password" ←
20
Enable the system module
Again, just copy and paste the snippet
21
Enable the system module
Again, just copy and paste the snippet
22
Enable the system module
Check your work
23
Enable the system module
Check your work
24
Enable the system module
All good
Disabled:
apache
auditd
aws
azure
(...)
25
Steps
Start Filebeat
26
And start it up!
Startup steps
$ >
27
First run the setup process
Setup preps dashboards and indices
$ >./filebeat setup
28
First run the setup process
Setup preps dashboards and indices
$ >./filebeat setup
Index setup finished.
29
First run the setup process
Setup preps dashboards and indices
$ >./filebeat setup
Index setup finished.
Loading dashboards (Kibana must be running and reachable)
30
First run the setup process
Setup preps dashboards and indices
$ >./filebeat setup
Index setup finished.
Loading dashboards (Kibana must be running and reachable)
Loaded dashboards
Loaded machine learning job configurations
Loaded Ingest pipelines
31
Finally, start it!
-e tells it to send messages to console
$ >./filebeat -e
32
Finally, start it!
-e tells it to send messages to console
$ >./filebeat -e
33
Essential needs for log analytics
Recall the earlier list
34
Needs for log analytics
Easy setup for variety of log sources
35
Needs for log analytics
Correlating and cross referencing
36
Needs for log analytics
Searching, filtering, and highlighting
37
Needs for log analytics
Visualize
38
Needs for log analytics
Visualize
39
Needs for log analytics
Visualize
40
Anomaly detection and alerting
Can't stare at the screen all day
41
Needs for log analytics
Flexible retention
42
Needs for log analytics
Anomaly detection and alerting
43
Essential needs for log analytics
From the earlier list
44
Agenda
Beyond logging: Observability
45
You can add metrics in the same manner
Select your integration
46
Many integrations
For example, system metrics
47
Metrics
Visualizing metrics
t e m
s
S board
y
as h
D
48
Metrics
Visualizing metrics
t e m
s
S board
y
as h
D
49
Metrics
Exploring metrics
i cs
e t r
M lorer
E x p
50
Metrics
Inventory view with multiple perspectives
51
Integrated Experience
Observability with one datastore
h ow n
S atio
e g r n
t
in igat i o
nav
52
Setting up APM
Instructions in Kibana
53
Application Performance Monitoring
Distributed Tracing
i ew
a l lV
er f
a t
W
54
Uptime Monitoring
Service availability
t a
Jus shot
e en
scr
55
Uptime Monitoring
Service availability
t a
Jus shot
e en
scr
56
Uptime Monitoring
Integrated experience
t a
Jus shot
e en
scr
57
Integrated Experience
Observability with one datastore
0 2 0
w 2 d
h o oa r
S hb
das
58
Integrated Experience
Observability with one datastore
0 2 0
w 2 d
h o oa r
S hb
das
59
Integrated Experience
Observability with one datastore
0 2 0
w 2
o
S anvas
h
C
60
Agenda
Securing your Beats
61
Recall the Filebeat steps
Use parameterized credentials
62
beats_writer Role
Required permissions
• Cluster Permissions:
‒ monitor
‒ read_ilm
‒ manage_index_templates
‒ manage_pipeline
https://www.elastic.co/guide/en/beats/filebeat/current/feature-roles.html
63
Corresponding User
Tying roles to users
https://www.elastic.co/guide/en/beats/filebeat/current/feature-roles.html
64
Set up the keystore
Hiding credentials for beats-writer
$ >./filebeat keystore
Manage secrets keystore
• Command: filebeat keystore
Usage:
filebeat keystore [command] • Create the keystore
Available Commands: • filebeat keystore add:
add Add secret
create Create keystore ‒ BEATS_WRITER_USER
list List keystore
remove Remove secret ‒ BEATS_WRITER_PASSWORD
• Access keys via ${KEY_NAME}
65
Previous Configuration
Had the user & password hardcoded
File Edit Options Buffers Tools Help
cloud.id: "Sandbox:dXMtY2VudHJ..."
cloud.auth: "elastic:long-random-password" # because we are using Elastic Cloud
cloud.id: "Sandbox:dXMtY2VudHJ..."
cloud.auth: "${BEATS_WRITER_USER}:long-random-password" # because we are using Elastic Cloud
cloud.id: "Sandbox:dXMtY2VudHJ..."
cloud.auth: "${BEATS_WRITER_USER}:${BEATS_WRITER_PASSWORD}" # because we are using Elastic Cloud
69
Finally, start it!
assumes that you've run setup
$ >./filebeat -e
70
Continuing your Journey
Where to find more information
• Spin up a cluster
‒ Hosted: cloud.elastic.co
‒ Self managed - elastic.co/downloads
Thank you!
72