On Centralizing Logs

39

Click here to load reader

description

On Centralizing Logs with Syslog, LogStash, Elasticsearch, Kibana. Presentation from Radu Gheorghe from Sematext at Monitorama EU 2013.

Transcript of On Centralizing Logs

Page 1: On Centralizing Logs

On Centralizing Logs

Radu Gheorghe

@radu0gheorghe

[email protected]

@sematext

Page 2: On Centralizing Logs

Hello World!

Logsene

mlmoneu13cf for -44%

Page 3: On Centralizing Logs

app

app

app

app

files

files

Page 4: On Centralizing Logs

app

app

app

app

files

filesElasticsearchlogstash

Kibana

Page 5: On Centralizing Logs

Elasticsearch Reason #1: Quick Search

No indexing

But...

=>

Page 6: On Centralizing Logs

...and other reasons

good write speed lots of tools for logging

scales easily

Page 7: On Centralizing Logs

Production Tips

stability performance

Page 8: On Centralizing Logs

Stability 1/4: Discovery

multicast unicast

vs

cluster name list of nodes

+ plugins: EC2, GCE

Page 9: On Centralizing Logs

Stability 2/4: Preventing Split Brain

minimum_master_nodes = N/2 + 1

Page 10: On Centralizing Logs

Stability 3/4: No OOMs, pls!

1GB

½ total RAM

Monitor the requirements

SPM for Elasticsearch

20% off with MONEU2013

Page 11: On Centralizing Logs

Stability 4/4: Field Cache

can be changed to

index.cache.field.type: soft

indices.fielddata.cache.size: X%

Page 12: On Centralizing Logs

Performance 1/4: Bulk Processing

use Bulk APIor Bulk UDP API

...translog.flush_threshold_ops

Page 13: On Centralizing Logs

Performance 2/4: Refresh Interval

http://blog.sematext.com/2013/07/08/elasticsearch-refresh-interval-vs-indexing-performance/

default:every second => but

every 5s+25% indexing*

every 30s+70% indexing*

Page 14: On Centralizing Logs

Performance 3/4: Timed Indices

Page 15: On Centralizing Logs

Performance 4/4: Buffers

...index_buffer_size: 30%(YMMV)

index.store.type: mmapfs(on 64-bit machines)

http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html

Page 16: On Centralizing Logs

Setting Up Kibana as Frontend

servers you

Page 17: On Centralizing Logs

Kibana: Search

Page 18: On Centralizing Logs

Kibana: Visualize

Page 19: On Centralizing Logs

Meet Some Syslog Daemons

syslogdtraditional

everywhere

syslog-ngOSE, PE

documentation++config format++

rsyslogOSS onlyES output*

* http://blog.sematext.com/2013/07/01/recipe-rsyslog-elasticsearch-kibana/

Page 20: On Centralizing Logs

X-ray of a Modern Syslog Daemon

read+bufferfile

/dev/log…

parsesyslog formats

JSONunstructured data

assembleconditionalsformatting

...

buffer+writefile

syslogElasticsearch

...

Page 21: On Centralizing Logs

2001's RFC3164: The Semi-Standard

<10>Oct 11 22:14:15 host program:hello world

TCP + LF =

no year, ms, nor TZ

little structure

Page 22: On Centralizing Logs

2009's RFC5424

<165>1 2003-10-11T22:14:15.003Z host program - - - [origin ip="192.168.0.1"] hello world

[ structured=data ] octet-count* + LF =

* UDP (RFC5426), TCP (RFC6587), TLS (RFC5425)

Page 23: On Centralizing Logs

Teaching Old Dog New Tricks

RSYSLOG_ForwardFormat(ISO8601 over RFC3164)

$MaxMessageSize 2048klog_message_size(2097152)

@cee: {"message": "hello world"} @@(o)192.168.0.1

octet-counted framing

Page 24: On Centralizing Logs

Reliable Transport? Encryption?

TCP + TLS (RFC5425)

RLTP + TLS RELP + TLS

Page 25: On Centralizing Logs

Logstash: The Swiss Army Knife

inputs(+codecs)

filters(parse, modify)

outputs(+codecs)

lots of plugins => lots of options

Page 26: On Centralizing Logs

Logstash: Example

Lumberjack

Logstash Elasticsearch

Page 27: On Centralizing Logs

Logstash: Add Buffer

Lumberjack

Lumberjack

Page 28: On Centralizing Logs

Logstash: Scale Everything

Lumberjack

Lumberjack

Lumberjack

Lumberjack

Page 29: On Centralizing Logs

Back to the Beginning

Lumberjack

Lumberjack

Lumberjack

Lumberjack

syslogd

Page 30: On Centralizing Logs

Logsene

Lumberjack

Lumberjack

Lumberjack

Lumberjack

syslogd

Logsene

http://sematext.com/logsene

Page 31: On Centralizing Logs

(More) Alternatives

files

syslog

Page 32: On Centralizing Logs

Alternatives Can Mix

files

syslog

LogstashElasticsearch Kibana

Page 33: On Centralizing Logs

Thank you!

Radu Gheorghe

@radu0gheorghe

[email protected]

@sematext

Page 34: On Centralizing Logs
Page 35: On Centralizing Logs

rsyslog 1/4: Upgrade to 7.x

RPMs or DEBs better performance

nicer config format omelasticsearch

Page 36: On Centralizing Logs

rsyslog 2/4: Faster Inputs

UDPincrease TimeRequery

TCPuse imptcp

Page 37: On Centralizing Logs

rsyslog 3/4: Main Message Queue

$MainMsgQueueType FixedArray$MainMsgQueueSize 1000000....

...or LinkedList or Disk

$...DequeueBatchSize 1000 $...WorkerThreads 3

Page 38: On Centralizing Logs

rsyslog 4/4: Action Queue

queue.type="linkedlist" queue.size="1000000"

bulkmode="on" # ES specific queue.dequeuebatchsize="1000"

queue.workerthreads="3"

Page 39: On Centralizing Logs

Thank you!

Radu Gheorghe

@radu0gheorghe

[email protected]

@sematext