logstash: get to know your logs

26
Logstash! Get to know your logs Dan Ivovich BMore on Rails 4/9/13

Upload: smartlogic

Post on 26-Jan-2015

111 views

Category:

Technology


3 download

DESCRIPTION

Dan Ivovich walks through getting started with Logstash

TRANSCRIPT

Page 1: Logstash: Get to know your logs

Logstash!Get to know your logs

Dan Ivovich

BMore on Rails4/9/13

Page 3: Logstash: Get to know your logs

What is the goal?

● Collect, Parse, and Store your log events

● Make log events searchable

● Analyze log events

Page 4: Logstash: Get to know your logs

Why bother?● Got logs?

○ syslog○ nginx access log○ application logs○ database logs

Are they all formatted the same?

Page 5: Logstash: Get to know your logs
Page 6: Logstash: Get to know your logs

3 Parts

● Inputs

● Filters

● Outputs

Page 7: Logstash: Get to know your logs

Inputs

● Files● TCP/UDP● Redis● AMQP● rsyslog● xmpp

http://logstash.net/docs/1.1.9/ - Full list

Page 8: Logstash: Get to know your logs

Filters

● grep● mutate● anonymize● date● grok

http://logstash.net/docs/1.1.9/ - Full list

Page 9: Logstash: Get to know your logs

Outputs

● Files● TCP/UDP● Redis● AMQP● elasticsearch

http://logstash.net/docs/1.1.9/ - Full list

Page 10: Logstash: Get to know your logs

Getting Startedinput { stdin { type => "stdin-type"} }

output { stdout { debug => true debug_format =>

"json"} }

java -jar logstash-1.1.9-monolithic.jar agent -f

logstash-simple.conf

Type something!

Page 11: Logstash: Get to know your logs

See our message!

Page 12: Logstash: Get to know your logs

Parse something!input { stdin { type => "stdin-type"} }

filter { grok { type => "stdin-type" pattern =>

"Hello %{DATA:message}!" } }

output { stdout { debug => true debug_format =>

"json"} }

java -jar logstash-1.1.9-monolithic.jar agent -f

logstash-simple.conf

Say Hello!

Page 13: Logstash: Get to know your logs

See our message in a field!

Page 14: Logstash: Get to know your logs

Life is better with searchinput { stdin { type => "stdin-type" } }

output {

stdout { debug => true debug_format => "json" }

elasticsearch { embedded => true }

}

java -jar logstash-1.1.9-monolithic.jar agent -f

logstash-search.conf

cURL for it!

Page 15: Logstash: Get to know your logs

Search for the data

Page 16: Logstash: Get to know your logs

Well that isn't pretty

Enter Kibana

Page 17: Logstash: Get to know your logs

Kibana is a friendly interface for your logs

Page 18: Logstash: Get to know your logs

Kibana Connects to Elasticsearch

How do we put it together?

● Logstash parses and structures data into Elasticsearch

● Kibana makes that data available● Apache Lucene Query Syntax (from elasticsearch)● Field statistics● Range searches

Page 19: Logstash: Get to know your logs

It Was Simple to Startinput { stdin { type => "stdin-type" } }

output {

stdout { debug => true debug_format => "json" }

elasticsearch { embedded => true }

}

java -jar logstash-1.1.9-monolithic.jar agent -f

logstash-search.conf

But Let's Get Real

Page 20: Logstash: Get to know your logs

On a server with logs

Page 21: Logstash: Get to know your logs

Logstash/Elasticsearch

Page 22: Logstash: Get to know your logs

Demo

Page 23: Logstash: Get to know your logs

Thoughts....

● Easy to try out, but for anything real, you'll want a much

more complicated configuration

● The variety of inputs is great

● Easy to build up a nice stack of filters

Page 24: Logstash: Get to know your logs

More Thoughts....

● Slow to boot monolithic jar file can be frustrating

○ Flatjar?

● Hard to track down why logs aren't flowing

● Elasticsearch node discovery can be difficult

○ If your cluster doesn't have a node added to it when

your client starts, your client isn't connected