Log forwarding at Scale

44
Log Forwarding at Scale Scale 15X, Pasadena, CA Eduardo Silva (@edsiper) [email protected]

Transcript of Log forwarding at Scale

Page 1: Log forwarding at Scale

Log Forwarding at Scale

Scale 15X, Pasadena, CAEduardo Silva (@edsiper)[email protected]

Page 2: Log forwarding at Scale

/about

● Open Source Engineer at Treasure Data

● Repositories / Projects

○ github.com/edsiper○ fluentbit.io○ duda.io○ monkey-project.com

Page 3: Log forwarding at Scale

“Logging is Simple”

Page 4: Log forwarding at Scale

“Logging is Simple”

Page 5: Log forwarding at Scale

“Logging is Simple”

Logs App Analysis

Logging exists because of Analysis needs

Page 6: Log forwarding at Scale

Before Analysis

Logs Database

Someone have to do some work

?

Page 7: Log forwarding at Scale

In a galaxy not so far away...

Logs Database

Page 8: Log forwarding at Scale

Analysis

Page 9: Log forwarding at Scale

Internally, Logging is not Simple

Page 10: Log forwarding at Scale

Scale Logging Requires Understanding

Page 11: Log forwarding at Scale

Logging Pipeline

Page 12: Log forwarding at Scale

Logging Pipeline

Log Messages Parse Filter Buffer

Routing

Elasticsearch

InfluxDB

Others

Page 13: Log forwarding at Scale

Logging Pipeline

Log Messages Parse Filter Buffer

Routing

Elasticsearch

InfluxDB

Others

● Log files● Journald● TCP

Page 14: Log forwarding at Scale

Logging Pipeline

Log Messages Parse Filter Buffer

Routing

Elasticsearch

InfluxDB

Others

Format / Structure:

● JSON● Regex / Named Capture

Page 15: Log forwarding at Scale

Logging Pipeline

Log Messages Parse Filter Buffer

Routing

Elasticsearch

InfluxDB

Others

Alter content: Grep, Exclude, Metadata

Page 16: Log forwarding at Scale

Logging Pipeline

Log Messages Parse Filter Buffer

Routing

Elasticsearch

InfluxDB

Others

Memory / Filesystem

Page 17: Log forwarding at Scale

Logging Pipeline

Log Messages Parse Filter Buffer

Routing

Elasticsearch

InfluxDB

OthersDeliver buffers to N destinations

Logging Pipeline

Page 18: Log forwarding at Scale

Logging Pipeline

Log Messages Parse Filter Buffer

Routing

Elasticsearch

InfluxDB

Others

Logging Pipeline

Page 19: Log forwarding at Scale

Logging Pipeline

● How to deal with the Logging Pipeline ?

● Is there any solution around ?

Page 20: Log forwarding at Scale
Page 21: Log forwarding at Scale

About Fluentd

● Created by

● Now hosted at

Page 22: Log forwarding at Scale

About Fluentd

● More than 600 plugins available

● Pluggable Architecture

● Built-in Reliability

● Full integration with Docker and Kubernetes

● Written in Ruby + C

Page 23: Log forwarding at Scale

Fluentd Modes

● Log Forwarder

● Log Aggregator

Page 24: Log forwarding at Scale

Log Aggregator = (Forwarder + Buffering Capabilities)

Page 25: Log forwarding at Scale

Edge Nodes / Forward to Aggregators

App

Node 1

DB

App DB

Page 26: Log forwarding at Scale

Edge Nodes & Costs

Page 27: Log forwarding at Scale

Edge Nodes & Costs

● Fluentd requires ~40MB as minimum

● Deploying a few hundred could be expensive

● Can we make Forward cheaper ?

Page 28: Log forwarding at Scale

Forwarder & Aggregator

Log Forwarder Log Aggregator

Page 29: Log forwarding at Scale
Page 30: Log forwarding at Scale

About Fluentd

● Written in C

● Pluggable Architecture

● Built-in Reliability

● Event Driven - Async I/O

Page 31: Log forwarding at Scale

Why Fluent Bit as a Forwarder

● Features

○ Input, Filter and Output Plugins

○ Built-in parsing support

○ Minimum memory required 450KB

Page 32: Log forwarding at Scale

Edge Nodes / Forward to Aggregators

Page 33: Log forwarding at Scale

Cheap Forwarding

Page 34: Log forwarding at Scale

Cloud Native Features

● Docker & Kubernetes Support

● Buffering fully controled○ pause() / resume() for input plugins

● Easy to containerize○ Small memory footprint○ No dependencies (all are built-in)

Page 35: Log forwarding at Scale

Hands on!

DEMO #1

Unstructured vs Structured data

Page 36: Log forwarding at Scale

Unstructured v/s Structured

● Why

○ Structured data have a schema

○ Easy to convert to different representations

○ It can be filtered

Page 37: Log forwarding at Scale

Hands on!

DEMO #2

Process Docker Logs

Page 38: Log forwarding at Scale

Kubernetes use case

● Applications runs in Containers

● Containers runs in a POD

● Multiple PODs can exists in a Node

● How to solve logging ?

Page 39: Log forwarding at Scale

Hands on!

DEMO #3Kubernetes: parse logs and append Metadata

API Server Nodes

Page 40: Log forwarding at Scale

Kubernetes

Metadata Support Status

The new kubernetes filter takes care of the following metadata handling:

○ Local data: POD Name, Namespace, Container Name and Container ID.

○ Remote (API Server): Labels and Annotations

Page 41: Log forwarding at Scale

Fluent Bit, what else ?

Networking and Co-routines

Easier implementation of output plugins that interact with networking operations like socket(), connect(), read(), write(), etc.

Fluent Bit provides non-blocking networking API that uses the event-loop with co-routines to implement:

● Network I/O● TLS/SSL usage● HTTP Client

Page 42: Log forwarding at Scale

Kubernetes DaemonSet

Github Repository

● https://github.com/fluent/fluent-bit-kubernetes-daemonset

Docker Image (ubuntu-slim)

● quay.io/fluent/fluent-bit-kubernetes-daemonset

Page 43: Log forwarding at Scale

Roadmap

Next Release v0.11 (March 2017)

● Kubernetes support (filter_kubernetes)● Parsers & Filters● Memory optimizations

Release v0.12 (May 2017)

● in_tail + Multiline support● Monitoring - re-enable HTTP service end-point: memory, records

flow, others.

Page 44: Log forwarding at Scale

Thanks!

Project information

● Web site Fluentbit.io● Documentation http://fluentbit.io/documentation/● Github http://github.com/fluent/fluent-bit

Contact

● Slack http://slack.fluentd.org (fluent-bit channel)● Twitter @fluentbit