• Home
  • Logging with EFK

Learn how to aggregate logs on Kubernetes. Logging with ElasticsSearch, Fluent Bit, and Kibana (EFK).

Logging with EFK

Learn how to aggregate logs on Kubernetes. Logging with ElasticsSearch, Fluent Bit, and Kibana (EFK).
Logging with EFK

This lab takes you through the basics of deploying a logging solution for observing your applications on Kubernetes. The premise is all the log streams generated by the applications are aggregated into a central datastore. From that datastore, queries and filters produce views from the aggregated logs.

Applications in containers should only produce logs as event streams and leave the aggregation and routing to other services on Kubernetes. This pattern is emphasized as factor 11 Logs of the The Twelve Factors App methodology.

Commonly the three components ElasticSearch, Fluentd, and Kibana (EFK) are combined for the stack. Sometimes stack use Fluent Bit instead of Fluentd. Fluent Bit is mostly functionally the same, but lighter in features and size. Other solutions sometimes use Logstash (ELK) instead of Fluentd.

In this lab, you will learn how to:

    ☐ Deploy ElasticSearch, Fluentd, and Kibana
    ☐ Generate log events and query then in Kibana

Forwarding: Fluent Bit

Fluent Bit

Fluentd is an open source data collector, that lets you unify the data collection and consumption for better use and understanding of data. In this stack Fluent Bit runs on each node (DaemonSet) and collects all the logs from /var/logs and routes them to ElasticSearch.

This example could use a lighter variation of Fluentd called Fluent Bit . Perhaps EfK, with a lower case ‘f’ is apropos. Alen Komljen covers the reason why in his blog .

Another variation for logging is the ELK stack that includes Logstash as a substitution for the Fluent aggregation solution.

Aggregation: ElasticSearch

Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.

Viewing: Kibana

Kibana is an open source data visualization plugin for Elasticsearch. It provides visualization capabilities on top of the content indexed on an Elasticsearch cluster. Users can create bar, line and scatter plots, or pie charts and maps on top of large volumes of data.

For Kubernetes, there are a wide variety of ways to assemble an EFK stack, especially with production or business-critical clusters. Some solutions may leverage an ElasticSearch service outside the cluster, perhaps offered by a cloud provider. For any solution that’s deployed to Kubernetes, it’s recommended to use Helm charts. Even with Helm charts there are a variety of solutions evolving and competing with each other.

However, this lab is aimed to show how you can get a working stack up with reasonable ease so you can see how the components are installed and work with each other.

  • LEVEL

    Beginner

  • DURATION

    20 minutes

  • UPDATED

    31 Dec, 2021