contents

Front matter

foreword

preface

acknowledgments

about this book

about the author

about the cover illustration

   

Part 1. From zero to “Hello World”

  1 Introduction to Fluentd

  1.1   Elevator pitch for Fluentd

 What is a log event?

 Fluentd compared to middleware

  1.2   Why do we produce logs?

  1.3   Evolving ideas

 Four golden signals

 Three pillars of observability

  1.4   Log unification

 Unifying logs vs. log analytics

  1.5   Software stacks

 ELK stack

 Comparing Fluentd and Logstash

 The relationship between Fluentd and Fluent Bit

 The relationship between Logstash and Beats

  1.6   Log routing as a vehicle for security

  1.7   Log event life cycle

  1.8   Evolution of Fluentd

 Treasure Data

 CNCF

 Relationship to major cloud vendors PaaS/IaaS

  1.9   Where can Fluentd and Fluent Bit be used?

 Platform constraints

  1.10 Fluentd UI-based editing

  1.11 Plugins

  1.12 How Fluentd can be used to make operational tasks easier

 Actionable log events

 Making logs more meaningful

 Polyglot environments

 Multiple targets

 Controlling log data costs

 Logs to metrics

 Rapid operational consolidation

  2 Concepts, architecture, and deployment of Fluentd

  2.1   Architecture and core concepts

 The makeup of a log event

 Handling time

 Architecture of Fluentd

 Fluent configuration execution order

 Directives

 Putting timing requirements into action

  2.2   Deployment of Fluentd

 Deploying Fluentd for the book’s examples

 Deployment considerations for Fluentd

 Fluentd minimum footprint

 Simple deployment of Ruby

 Simple deployment of Fluentd

 Deploying a log generator

 Installing Postman

  2.3   Bringing Fluentd to life with “Hello World”

 “Hello World” scenario

 “Hello World” configuration

 Starting Fluentd

  2.4   “Hello World” with Fluent Bit

 Starting Fluent Bit

 Alternate Fluent Bit startup options

 Fluent Bit configuration file comparison

 Fluent Bit configuration file in detail

 Putting the dummy plugin into action

  2.5   Fluentd deployment with Kubernetes and containers

 Fluentd DaemonSet

 Dockerized Fluentd

  2.6   Using Fluentd UI

 Installing Fluentd with UI

Part 2. Fluentd in depth

  3 Using Fluentd to capture log events

  3.1   Dry running to check a configuration

 Putting validating Fluentd configuration into action

  3.2   Reading log files

 Putting the adaption of a Fluentd configuration to Fluent Bit into action

 Rereading and resuming reading of log files

 Configuration considerations for tracking position

 Wildcards in the path attribute

 Expressing time

 Controlling the impact of wildcards in filenames

 Replacing wildcards with delimited lists in action

 Handling log rotation

  3.3   Self-monitoring

 HTTP interface check

  3.4   Imposing structure on log events

 Standard parsers

 Third-party parsers

 Applying a Regex parser to a complex log

 Putting parser configuration into action

  4 Using Fluentd to output log events

  4.1   File output plugin

 Basic file output

 Basics of buffering

 Chunks and Controlling Buffering

 Retry and backoff

 Putting configuring buffering size settings into action

  4.2   Output formatting options

 out_file

 json

 ltsv

 csv

 msgpack

 Applying formatters

 Putting JSON formatter configuration into action

  4.3   Sending log events to MongoDB

 Deploying MongoDB Fluentd plugin

 Configuring the Mongo output plugin for Fluentd

 Putting MongoDB connection configuration strings into action

  4.4   Actionable log events

 Actionable log events through service invocation

 Actionable through user interaction tools

  4.5   Slack to demonstrate the social output

 Handling tokens and credentials more carefully

 Externalizing Slack configuration attributes in action

  4.6   The right tool for the right job

  5 Routing log events

  5.1   Reaching multiple outputs by copying

 Copy by reference or by value

 Handling errors when copying

  5.2   Configuration reuse and extension through inclusion

 Place holding with null output

 Putting inclusions with a MongoDB output into action

  5.3   Injecting context into log events

 Extraction of values

  5.4   Tag-based routing

 Using exec output plugin

 Putting tag naming conventions into action

 Putting dynamic tagging with extract into action

  5.5   Tag plugins

  5.6   Labels: Taking tags to a new level

 Using a stdout filter to see what is happening

 Illustrating label and tag routing

 Connecting pipelines

 Label sequencing

 Special labels

 Putting a common pipeline into action

  6 Filtering and extrapolation

  6.1   Application of filters

 All is well events do not need to be distributed

 Spotting the needle in a haystack

 False urgency

 Releveling

 Unimplemented housekeeping

  6.2   Why change log events?

 Easier to process meaning downstream

 Add context

 Record when we have reacted to a log event

 Data redaction/masking

  6.3   Applying filters and parsers

 Filter plugins

 Applying grep filters

 Changing log events with the record_transformer plugin

 Filter parser vs. record transformer

  6.4   Demonstrating change impact with stdout in action

 A solution demonstrating change impact with stdout in action

  6.5   Extract to set key values

  6.6   Deriving new data values with the record_transformer

 Putting the incorporation of calculations into a log event transformation into action

  6.7   Generating simple Fluentd metrics

 Putting log event counting into action

Part 3. Beyond the basics

  7 Performance and scaling

  7.1   Threading and processes to scale with workers

 Seeing workers in action

 Worker constraints

 Controlling output plugin threads

 Memory management optimization

  7.2   Scaling and moving workloads

 Fan-in/log aggregation and consolidation

 Fan-out and workload distribution

 High availability

 Putting a high-availability comparison into action

  7.3   Fluentd scaling in containers vs. native and virtual environments

 Kubernetes worker node configuration

 Per-cluster configuration

 Container as virtualization

 Sidecar pattern

 Options comparison

  7.4   Securing traffic between Fluentd nodes

 TLS configuration

 TLS not just for encryption

 Certificate and private key storage

 Security is more than certificates

  7.5   Credentials management

 Simple credentials use case

 Putting certification into action

  8 Driving logs with Docker and Kubernetes

  8.1   Fluentd out of the box from Docker Hub

 Official Docker images

 Docker log drivers

 Getting set up for Docker log drivers

  8.2   Using Docker log drivers

 Docker drivers via the command line

 A quick check of network connections

 Running Docker command line

 Switching to driver configuration through a configuration file

  8.3   Kubernetes components logging and the use of Fluentd

 Kubernetes components and structured logging

 Kubernetes default log retention and log rotation

 kubectl with logging

  8.4   Demonstrating logging with Kubernetes

 Kubernetes setup

 Creating logs to capture

 Understanding how Fluentd DaemonSets are put together

  8.5   Getting a peek at host logs

  8.6   Configuring a Kubernetes logging DaemonSet

 Getting the Fluentd configuration ready to be used

 Creating our Kubernetes deployment configuration

 Putting the implementation of a Fluentd for Kubernetes into action

 Deploying to minikube

 Tidying up

  8.7   Kubernetes configuration in action

 Answer

  8.8   More Kubernetes monitoring and logging to watch for

 Node monitoring

 Termination messages

  9 Creating custom plugins

  9.1   Plugin source code

  9.2   What is Redis, and why build a plugin with the Redis list capability?

 Redis list over RedisTimeSeries

  9.3   Illustrating our objective using Redis CLI

  9.4   Preparing for development

  9.5   Plugin frameworks

 Creating the skeleton plugin

 Plugin life cycle

  9.6   Implementing the plugin core

 How configuration attributes work

 Starting up and shutting down

 Getting the plugin to work with our Fluentd installation

 Putting additional configuration validation into action

 Implementing the Redis output logic

 Putting the testing of synchronous output into action

  9.7   Implementing the Redis input plugin

 Testing input and output plugin execution

  9.8   Extending output with buffering

 Improving our scenario by putting maintainability into action

  9.9   Unit testing

  9.10 Putting the development of unit tests into action

 Answer

  9.11 Package and deployment

 Documentation

 Complete metadata aka manifest

 Building the gem package

 Rerun without the plugin paths

  9.12 Extending to be an enterprise-class solution

Part 4. Good logging practices and frameworks to maximize log value

10 Logging best practices

10.1   Audit events vs. log events

10.2   Log levels and severities

 Trace

 Debug

 Info(rmation)

 Warn(ing)

 Error

 Fatal

 Extending or creating your own log levels

10.3   Clear language

10.4   Human and machine-readable

10.5   Context is key

 Context: What

 Context: When

 Context: Where

 Context: Why

 Context: Who

 A practical checklist for capturing context

10.6   Error codes

 Using standard errors

 Codes can be for more than errors

10.7   Too little logging or too much?

 What qualifies as sensitive?

 GDPR is only the start

10.8   Log structure and format

 Putting making log entries ready for application shipping into action

10.9   Use frameworks if you can

10.10 Development practices

 Rethrowing exceptions

 Using standard exceptions and error structures

 String construction as a reason not to log

11 Logging frameworks

11.1   Value of logging frameworks

11.2   Typical structure of a logging framework

 Logger context

 Appender

 Logger

 Filter

 Formatter

 Configuration

 Logger config

11.3   Appender structures

11.4   Logging framework landscape

11.5   Choosing a framework

 Putting optimizing application logging into action

11.6   Fluentd’s own logging and appenders

11.7   Illustrations of an application logging directly to Fluentd

 Python with logging framework: Using the Fluentd library

 Invoking Fluentd appender directly

 Illustration with only Python’s logging

 Illustration without Python’s logging or Fluentd library

 Porting the Fluentd calls to another language into action

 Using generic appenders: The takeaways

   

Appendix A. Installation of additional tools and services

Appendix B. Processing times and dates, regular expressions, and other configuration values

Appendix C. Plugins summary

Appendix D. Real-world use case

Appendix E. Useful resources

   

index

   

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.183.252