From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

24
From zero to production hero: Log analysis with Elasticsearch Rafał Kuć Radu Gheorghe

Transcript of From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Page 1: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

From zero to production hero:

Log analysis with Elasticsearch

Rafał KućRadu Gheorghe

Page 2: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Who are we?RaduRafał

Page 3: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Our Company → SematextHQ: NYC + Globally Distributed Team

Search & Big Data Consulting

Production Support for Solr & Elasticsearch

Training for Solr & Elasticsearch (online and

onsite)Training in NYC

next week! Oct 19 & 20

Page 4: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Our Company → Sematext

Page 5: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

AgendaKibana

Elasticsearch essentials, tuning and scaling

Logstash

rsyslog

Logstash + rsyslog

Commands & Configs:https://github.com/sematext/velocity

Page 6: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Lucene Essentials

{"verb": "GET"}

document

Page 7: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Lucene Essentials

{"verb": "GET"}

1)GETdocument

stored

Page 8: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Lucene Essentials

GET 1,3,5

PUT 2,4

{"verb": "GET"}

1)GETdocument

stored

indexed

Page 9: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Analysis

(Macintosh; Intel Mac OSX; en)

["Macintosh", "Intel", "Mac", "OSX", "en"]

["macintosh", "intel", "mac", "osx", "en"]

standard tokenizer

lowercase token filter

Page 10: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Field data

GET 1,2

PUT 2,3

Page 11: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Field data

GET 1,2

PUT 2,3

Page 12: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Field data

GET 1,2

PUT 2,3

1) GET

2) GET,PUT

3) PUT

Page 13: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Field data

GET 1,2

PUT 2,3

1) GET

2) GET,PUT

3) PUT

expensive

Page 14: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Field data

GET 1,2

PUT 2,3

1) GET

2) GET,PUT

3) PUT

expensive

heap

Page 15: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Field data

GET 1,2

PUT 2,3

1) GET

2) GET,PUT

3) PUT

expensive

heap

http://bio-img.s3.amazonaws.com/bds/formhdr-cvr-5-memory-killing-foods-v2.png

Page 16: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

DocValues

GET 1,2

PUT 2,3

1) GET

2) GET,PUT

3) PUT

at index time; on disk

https://www.lorextechnology.com/images/products/HDD250GB/900x600/security-certified-HDD250GB-L1.png

Page 17: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

DocValues

GET 1,2

PUT 2,3

1) GET

2) GET,PUT

3) PUT

no uninverting!

at index time; on disk

https://www.lorextechnology.com/images/products/HDD250GB/900x600/security-certified-HDD250GB-L1.png

OS caches instead of heap

Page 18: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Logstash

/var/log/apache.log

GET /index.html

grok{

"verb": "GET","path": "/index.html"

}

- w $numberOfWorkers

workers => 2

filter

output

input

Elasticsearch

Page 19: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

rsyslog

/var/log/apache.log

GET /index.html

mmnormalize{

"verb": "GET","path": "/index.html"

}

queue.workerThreadsqueue.dequeueBatchSize

omelasticsearch

imfile input module

Elasticsearch

main queue (RAM+Disk)

queue.typequeue.size

...

Page 20: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

mmnormalize parse tree

sys

tem log

d -ng

=> scales very well with # of rules(performance depends more on log length)

Page 21: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

rsyslog + Redis via Kafka

rsyslog Apache Kafka Logstash Elasticsearch

file input

mmnormalize

omkafka +JSON template

Kafka input +JSON codec Elasticsearch

output

Page 22: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)

Free eBooks @ sematext.com

We are hiring toohttp://sematext.com/about/jobs.html

Page 23: From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity NYC 2015)