Introduction To Logging With The Elk Stack - 1
Introduction To Logging With The Elk Stack - 1
Introduction To Logging With The Elk Stack - 1
1
+
=
+ ObservaBL
Observability
T
2
Elastic Approach to
Observability
Dev & Ops
Teams
4
Agenda
Challenges with log analytics
5
Logs for one host or
appis fairly straightforward
This
$ > 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
Step
s
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
$ >./filebeat modules enable system
21
Enable the system
module
Again, just copy and paste the snippet
$ >./filebeat modules enable system
Enabled system
22
Enable the system
module
Check your work
$ >./filebeat modules enable system
Enabled system
23
Enable the system
module
Check your work
$ >./filebeat modules enable system
Enabled system
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!tells it to send messages to console
-e
$ >./filebeat -e
32
Finally, start
it!tells it to send messages to console
-e
$ >./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
tem
Sys board
ash
D
48
Metrics
Visualizing metrics
tem
Sys board
ash
D
49
Metrics
Exploring metrics
ics
etr r
M lore
Exp
50
Metrics
Inventory view with multiple perspectives
51
Integrated Experience
Observability with one datastore
ow
Sh tion
g ra
te ion
in igat
nav
52
Setting up
APM
Instructions in Kibana
53
Application Performance Monitoring
Distributed Tracing
iew
ll V
rf a
a te
W
54
Uptime Monitoring
Service availability
t a
Ju s ot
ns h
re e
sc
55
Uptime Monitoring
Service availability
t a
Ju s ot
ns h
re e
sc
56
Uptime Monitoring
Integrated experience
t a
Ju s ot
ns h
re e
sc
57
Integrated Experience
Observability with one datastore
0 20
w 2
ho a rd
S o
b
sh
da
58
Integrated Experience
Observability with one datastore
0 20
w 2
ho a rd
S o
b
sh
da
59
Deployment Network lillll 11111 11lmWI I l
Observability Traft,c In
Traffic Out
hi111
11 I
II
.11 l I
l/ l/l1
I
11111
jI W
I Ij
• nginx . . . _. , _
• redis _
• m ""9
Deployme
\\Ill - ,
\
_ '' '
5%
, : 68%: -
14% -
--
I
�
Memory ; Disk 10
Agenda
Securing your Beats
61
Recall the Filebeat
steps
Use parameterized credentials
• Download and install Filebeat
• Edit the configuration
• Enable and configure the system
module
• Start Filebeat
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
• Give the user the corresponding
roles
• Create a secure password
• beats-writer gets the writer
role we created, plus the
shipped beats_system role
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 • Create the keystore
[command]
• filebeat keystore add:
add
Available Add secret
Commands:
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
72