SlideShare a Scribd company logo
Using Logstash, ElasticSearch and Kibana
Alejandro E Brito Monedero
@ae_bm
2013 / 05 / 23
Business as usual
Using Logstash, elasticsearch & kibana
So many hosts to check
Is there life out there?
http://upload.wikimedia.org/wikipedia/commons/a/aa/ESO-The_Milky_Way_above_La_Silla-phot-27-04-hires.jpg
Time to play whack a log
http://i102.photobucket.com/albums/m109/niceperson907/121331d1253497450-animated-gif-thre.gif
http://brotality.com/wp-content/uploads/2012/12/madness.jpg
I need a new toy
http://www.youtube.com/watch?v=8L6Dpq5kY_A
Video time
Logstash ✔ collects logs
✔ parses logs
✔ stores logs
✔ indexes logs
✔ searches logs
✔ and fixes timestamps
You only need
● JVM
● logstash.jar
$ log_producer | grep ... | sed … | awk … | tee output 
| sort | uniq -c | sort -n
Log source Logstash
Logstash
(optional)
ElasticSearch
DB
statsd
Pipes
Inputs Filters Outputs
File
Redis
Syslog
Lumberjack
Rabbitmq
SQS
…
Alter
Date
Grok
Multiline
Grep
...
AMQP
Cloudwatch
Elasticsearch
Mongodb
Redis
File
...
Plugins
Not here yet? JRuby to the rescue
ElasticSearch
Distributed RESTful search server
● Near real-time search
● RESTful API
● Easy to scale horizontally
● HA
● Full text search
● YAML config file / JSON format!!
● Document oriented JSON
Getting started: Logstash JAR includes it / download and set cluster.name
This is where it will be worth to spend some time tuning
Kibana
✔ Nice UI
✔ Better than the old frontend logstash
included
✔ Ruby / framework Sinatra
Web frontend to search / graph and more
Original plan
Apache
(ligthweight shipper)
Tomcat
(ligthweight shipper)
broker logstash
ElasticSearch
Kibana
After a few workarounds
Apache
(logstash shipper)
Tomcat
(logstash shipper)
Logstash ElasticSearch
Kibana
SSH tunnels
Example config 1/3
Logstash-httpd.conf
input {
file {
type => "httpd"
path => ["/var/log/httpd/*-logstash.log"]
exclude => ["*.gz"]
start_position => "beginning"
format => "json_event"
}
}
output {
tcp {
host => "0.0.0.0"
mode => "server"
port => 1666
}
}
Logstash-server.conf
input {
tcp {
type => "httpd"
format => "json_event"
host => "127.0.0.1"
mode => "client"
port => "1666"
}
tcp {
type => "app"
format => "json_event"
host => "127.0.0.1"
mode => "client"
port => "2666"
}
}
output {
elasticsearch {
cluster => "logstash"
}
}
Example config 2/3
Logstash-tomcat.conf
filter {
# Tomcat
# Remove blank lines
grep {
type => "tomcat"
match => [ "@message", "(.+)" ]
drop => true
add_tag => [ "no_blank_lines" ]
}
# make the multilines be treated like a single line
multiline {
type => "tomcat"
pattern => "^dddd"
negate => true
what => "previous"
}
Example config 3/3
Logstash-tomcat.conf
# mark the exceptions (multiline)
grep {
type => "tomcat"
tags => [ "multiline" ]
match => [ "@message", ".+Exception: .+" ]
drop => false
add_tag => [ "java_exception" ]
}
# get the log level, operation id, module and timestamp as separated fields
grok {
type => "tomcat"
pattern => "%{TIMESTAMP_ISO8601:timestamp} [%{OPERATION_ID:operation_id}]..."
add_tag => [ "groked" ]
}
# fix the timestamp
date {
type => "tomcat"
match => [ "timestamp", "YYYY-MM-dd HH:mm:ss,SSSZZ" ]
add_tag => [ "timestamp_fix" ]
}
}
I need a new toy
Demo
Some remarks
● Don't forget about security
● The applications should be flexible enough for allowing to
publish their logs using brokers or other methods beyond
files and syslog
● Logging in JSON format is a nice to have
● Share the log visualization
● Use the brokers Luke
● If you develop internalize this
http://www.masterzen.fr/2013/01/13/the-10-
commandments-of-logging/
Extras
● http://logstash.net/
● http://www.logstashbook.com/code/ only $10.09
● https://github.com/logstash/logstash/blob/v1.1.12/patterns/grok-patterns
● http://grokdebug.herokuapp.com/
● http://www.infoq.com/articles/review-the-logstash-book (better diagrams)
●
http://www.elasticsearch.org/tutorials/using-elasticsearch-for-logs/
● http://kibana.org/
●
https://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/queryparsersyntax.html
● http://www.elasticsearch.org/tutorials/elasticsearch-on-ec2/
●
http://blog.lusis.org/blog/2012/01/31/load-balancing-logstash-with-amqp/
Do you want to join the <some fancy words here> team?
I am not hiring, but I can tell you about some places where
it is better to stay away
Have a nice day
All the images, videos and stuff are property of their respective owners, look at the cat
and don't sue me
http://stuffpoint.com/cats/image/41633/cute-cat-picture/

More Related Content

What's hot (20)

PPTX
Centralized log-management-with-elastic-stack
Rich Lee
 
PDF
Log analytics with ELK stack
AWS User Group Bengaluru
 
PDF
Solving PostgreSQL wicked problems
Alexander Korotkov
 
PDF
Sec013 その資格情報、簡
Tech Summit 2016
 
PDF
Kongの概要と導入事例
briscola-tokyo
 
PPTX
Log management with ELK
Geert Pante
 
PPTX
SSRF対策としてAmazonから発表されたIMDSv2の効果と破り方
Hiroshi Tokumaru
 
PPTX
Hashicorp Vault ppt
Shrey Agarwal
 
PPTX
Centralized logging
blessYahu
 
PDF
【メモ】一般的に設計書に定義される項目例
Hirokazu Yatsunami
 
PDF
Blazing Performance with Flame Graphs
Brendan Gregg
 
PDF
01_2021年上半期 AWS IoT サービスアップデート
Amazon Web Services Japan
 
PDF
PostgreSQL運用管理入門
Yoshiyuki Asaba
 
PDF
Secure element for IoT device
Kentaro Mitsuyasu
 
PDF
テスト文字列に「うんこ」と入れるな
Kentaro Matsui
 
PDF
Let's build Developer Portal with Backstage
Opsta
 
PPTX
Norikra + Fluentd + Elasticsearch + Kibana リアルタイムストリーミング処理 ログ集計による異常検知
daisuke-a-matsui
 
PPTX
Redisの特徴と活用方法について
Yuji Otani
 
PDF
Amazon Aurora - Auroraの止まらない進化とその中身
Amazon Web Services Japan
 
PDF
Introduction to Github Actions
Knoldus Inc.
 
Centralized log-management-with-elastic-stack
Rich Lee
 
Log analytics with ELK stack
AWS User Group Bengaluru
 
Solving PostgreSQL wicked problems
Alexander Korotkov
 
Sec013 その資格情報、簡
Tech Summit 2016
 
Kongの概要と導入事例
briscola-tokyo
 
Log management with ELK
Geert Pante
 
SSRF対策としてAmazonから発表されたIMDSv2の効果と破り方
Hiroshi Tokumaru
 
Hashicorp Vault ppt
Shrey Agarwal
 
Centralized logging
blessYahu
 
【メモ】一般的に設計書に定義される項目例
Hirokazu Yatsunami
 
Blazing Performance with Flame Graphs
Brendan Gregg
 
01_2021年上半期 AWS IoT サービスアップデート
Amazon Web Services Japan
 
PostgreSQL運用管理入門
Yoshiyuki Asaba
 
Secure element for IoT device
Kentaro Mitsuyasu
 
テスト文字列に「うんこ」と入れるな
Kentaro Matsui
 
Let's build Developer Portal with Backstage
Opsta
 
Norikra + Fluentd + Elasticsearch + Kibana リアルタイムストリーミング処理 ログ集計による異常検知
daisuke-a-matsui
 
Redisの特徴と活用方法について
Yuji Otani
 
Amazon Aurora - Auroraの止まらない進化とその中身
Amazon Web Services Japan
 
Introduction to Github Actions
Knoldus Inc.
 

Similar to Using Logstash, elasticsearch & kibana (20)

PDF
(Fios#02) 2. elk 포렌식 분석
INSIGHT FORENSIC
 
PDF
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Badoo Development
 
PDF
Logstash for SEO: come monitorare i Log del Web Server in realtime
Andrea Cardinale
 
PDF
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Yauheni Akhotnikau
 
PDF
Machine Learning Game Changer for IT - Maartens Lourens
OpenCredo
 
PPTX
Troubleshooting real production problems
Tier1 app
 
PDF
Mario
宗志 陈
 
PDF
Why you should be using structured logs
Stefan Krawczyk
 
PPTX
#OOP_D_ITS - 9th - Template
Hadziq Fabroyir
 
PPT
Troubleshooting performanceavailabilityproblems (1)
Tier1 app
 
PDF
Java/Spring과 Node.js의공존
동수 장
 
PDF
Undelete (and more) rows from the binary log
Frederic Descamps
 
PPTX
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
PROIDEA
 
PPTX
Fixing Web Data in Production
Aaron Knight
 
PDF
Openstack 簡介
kao kuo-tung
 
PDF
Kommons
Antonio Terreno
 
PDF
Hartwarming lightning talk in winter Sapporo
Jun OHWADA
 
PDF
Introduction of RiotJS
Ryo Iinuma
 
PPT
ELK stack at weibo.com
琛琳 饶
 
(Fios#02) 2. elk 포렌식 분석
INSIGHT FORENSIC
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Badoo Development
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Andrea Cardinale
 
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Yauheni Akhotnikau
 
Machine Learning Game Changer for IT - Maartens Lourens
OpenCredo
 
Troubleshooting real production problems
Tier1 app
 
Mario
宗志 陈
 
Why you should be using structured logs
Stefan Krawczyk
 
#OOP_D_ITS - 9th - Template
Hadziq Fabroyir
 
Troubleshooting performanceavailabilityproblems (1)
Tier1 app
 
Java/Spring과 Node.js의공존
동수 장
 
Undelete (and more) rows from the binary log
Frederic Descamps
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
PROIDEA
 
Fixing Web Data in Production
Aaron Knight
 
Openstack 簡介
kao kuo-tung
 
Hartwarming lightning talk in winter Sapporo
Jun OHWADA
 
Introduction of RiotJS
Ryo Iinuma
 
ELK stack at weibo.com
琛琳 饶
 
Ad

More from Alejandro E Brito Monedero (14)

ODP
Mad scalability (perfomance debugging)
Alejandro E Brito Monedero
 
ODP
Tres historias
Alejandro E Brito Monedero
 
ODP
AMQP vs GRAPHITE
Alejandro E Brito Monedero
 
ODP
Sysdig SRECon 16 Europe
Alejandro E Brito Monedero
 
ODP
Funcional para trollear
Alejandro E Brito Monedero
 
ODP
Fabric más allá de lo básico
Alejandro E Brito Monedero
 
ODP
Experiencias con PostgreSQL en AWS
Alejandro E Brito Monedero
 
ODP
Fabric Fast & Furious edition
Alejandro E Brito Monedero
 
ODP
Así que pusiste MongoDB. Dime ¿cómo lo administras?
Alejandro E Brito Monedero
 
ODP
AWS Baby steps circa 2008
Alejandro E Brito Monedero
 
ODP
Wireshark tips
Alejandro E Brito Monedero
 
PDF
Mi experiencia con Amazon AWS EC2 y S3
Alejandro E Brito Monedero
 
Mad scalability (perfomance debugging)
Alejandro E Brito Monedero
 
AMQP vs GRAPHITE
Alejandro E Brito Monedero
 
Sysdig SRECon 16 Europe
Alejandro E Brito Monedero
 
Funcional para trollear
Alejandro E Brito Monedero
 
Fabric más allá de lo básico
Alejandro E Brito Monedero
 
Experiencias con PostgreSQL en AWS
Alejandro E Brito Monedero
 
Fabric Fast & Furious edition
Alejandro E Brito Monedero
 
Así que pusiste MongoDB. Dime ¿cómo lo administras?
Alejandro E Brito Monedero
 
AWS Baby steps circa 2008
Alejandro E Brito Monedero
 
Mi experiencia con Amazon AWS EC2 y S3
Alejandro E Brito Monedero
 
Ad

Recently uploaded (20)

PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 

Using Logstash, elasticsearch & kibana

  • 1. Using Logstash, ElasticSearch and Kibana Alejandro E Brito Monedero @ae_bm 2013 / 05 / 23
  • 4. So many hosts to check Is there life out there? http://upload.wikimedia.org/wikipedia/commons/a/aa/ESO-The_Milky_Way_above_La_Silla-phot-27-04-hires.jpg
  • 5. Time to play whack a log http://i102.photobucket.com/albums/m109/niceperson907/121331d1253497450-animated-gif-thre.gif
  • 7. I need a new toy http://www.youtube.com/watch?v=8L6Dpq5kY_A Video time
  • 8. Logstash ✔ collects logs ✔ parses logs ✔ stores logs ✔ indexes logs ✔ searches logs ✔ and fixes timestamps You only need ● JVM ● logstash.jar
  • 9. $ log_producer | grep ... | sed … | awk … | tee output | sort | uniq -c | sort -n Log source Logstash Logstash (optional) ElasticSearch DB statsd Pipes
  • 11. ElasticSearch Distributed RESTful search server ● Near real-time search ● RESTful API ● Easy to scale horizontally ● HA ● Full text search ● YAML config file / JSON format!! ● Document oriented JSON Getting started: Logstash JAR includes it / download and set cluster.name This is where it will be worth to spend some time tuning
  • 12. Kibana ✔ Nice UI ✔ Better than the old frontend logstash included ✔ Ruby / framework Sinatra Web frontend to search / graph and more
  • 13. Original plan Apache (ligthweight shipper) Tomcat (ligthweight shipper) broker logstash ElasticSearch Kibana
  • 14. After a few workarounds Apache (logstash shipper) Tomcat (logstash shipper) Logstash ElasticSearch Kibana SSH tunnels
  • 15. Example config 1/3 Logstash-httpd.conf input { file { type => "httpd" path => ["/var/log/httpd/*-logstash.log"] exclude => ["*.gz"] start_position => "beginning" format => "json_event" } } output { tcp { host => "0.0.0.0" mode => "server" port => 1666 } } Logstash-server.conf input { tcp { type => "httpd" format => "json_event" host => "127.0.0.1" mode => "client" port => "1666" } tcp { type => "app" format => "json_event" host => "127.0.0.1" mode => "client" port => "2666" } } output { elasticsearch { cluster => "logstash" } }
  • 16. Example config 2/3 Logstash-tomcat.conf filter { # Tomcat # Remove blank lines grep { type => "tomcat" match => [ "@message", "(.+)" ] drop => true add_tag => [ "no_blank_lines" ] } # make the multilines be treated like a single line multiline { type => "tomcat" pattern => "^dddd" negate => true what => "previous" }
  • 17. Example config 3/3 Logstash-tomcat.conf # mark the exceptions (multiline) grep { type => "tomcat" tags => [ "multiline" ] match => [ "@message", ".+Exception: .+" ] drop => false add_tag => [ "java_exception" ] } # get the log level, operation id, module and timestamp as separated fields grok { type => "tomcat" pattern => "%{TIMESTAMP_ISO8601:timestamp} [%{OPERATION_ID:operation_id}]..." add_tag => [ "groked" ] } # fix the timestamp date { type => "tomcat" match => [ "timestamp", "YYYY-MM-dd HH:mm:ss,SSSZZ" ] add_tag => [ "timestamp_fix" ] } }
  • 18. I need a new toy Demo
  • 19. Some remarks ● Don't forget about security ● The applications should be flexible enough for allowing to publish their logs using brokers or other methods beyond files and syslog ● Logging in JSON format is a nice to have ● Share the log visualization ● Use the brokers Luke ● If you develop internalize this http://www.masterzen.fr/2013/01/13/the-10- commandments-of-logging/
  • 20. Extras ● http://logstash.net/ ● http://www.logstashbook.com/code/ only $10.09 ● https://github.com/logstash/logstash/blob/v1.1.12/patterns/grok-patterns ● http://grokdebug.herokuapp.com/ ● http://www.infoq.com/articles/review-the-logstash-book (better diagrams) ● http://www.elasticsearch.org/tutorials/using-elasticsearch-for-logs/ ● http://kibana.org/ ● https://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/queryparsersyntax.html ● http://www.elasticsearch.org/tutorials/elasticsearch-on-ec2/ ● http://blog.lusis.org/blog/2012/01/31/load-balancing-logstash-with-amqp/
  • 21. Do you want to join the <some fancy words here> team? I am not hiring, but I can tell you about some places where it is better to stay away Have a nice day All the images, videos and stuff are property of their respective owners, look at the cat and don't sue me http://stuffpoint.com/cats/image/41633/cute-cat-picture/