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

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