10 Building plugins

 

This chapter covers

  • Implementing custom plugins using the Go language
  • Using the Fluent Bit–provided Go binding layer
  • Consuming Fluent Bit configuration data to control plugin behavior
  • Managing data between method calls using the context object
  • Seeing how contexts are applied for multiple instances of the same plugin type

So far in the book, we’ve concentrated on using capabilities entirely within a standard Fluent Bit deployment. Chapter 9 went through the options for building custom plugins. In this chapter, we will implement input and output plugins using Go.

10.1 Architectural context

We’ve reviewed the options and elected to build custom plugins. Now let’s revisit our architectural view to see how our development relates to our architectural view, as shown in figure 10.1. Using Go currently allows us to interact only with the input and output plugin frameworks, so we won’t see any of the inner workings, such as the buffers.

Figure 10.1 Logical architecture of Fluent Bit, with this chapter's focus highlighted
figure

To understand the development of a Go plugin, we need to look more closely at a few technical areas:

10.2 Why Go?

10.3 Plugin objective

10.4 Go plugin approach

10.4.1 Simplifying our build process

10.4.2 Code structure

10.4.3 Fluent Bit feature switches

10.4.4 The build process for plugins

10.5 Understanding the plugin life cycle

10.5.1 Input life cycle

10.5.2 Output life cycle

10.6 Implementing the plugin

10.6.1 Setting up MySQL

10.6.2 Input plugin

10.6.3 Building the code

10.6.4 Output plugin

10.7 Deploying the custom plugin