Path: blob/main/docs/sources/flow/concepts/modules.md
4096 views
---
---
Modules
Modules are a way to create Grafana Agent Flow configurations which can be loaded as a component. Modules are a great way to parameterize a configuration to create reusable pipelines.
Modules are Grafana Agent Flow configurations which have:
Arguments: settings which configure a module.
Exports: named values which a module exposes to the consumer of the module.
Components: Grafana Agent Flow Components to run when the module is running.
Modules are loaded into Grafana Agent Flow by using a Module loader.
Refer to the documentation for the [argument block][] and [export block][] to learn how to define arguments and exports for a module.
[argument block]: {{< relref "../reference/config-blocks/argument.md" >}} [export block]: {{< relref "../reference/config-blocks/export.md" >}}
Module loaders
A Module loader is a Grafana Agent Flow component which retrieves a module and runs the components defined inside of it.
Module loader components are responsible for:
Retrieving the module source to run.
Creating a [Component controller][] for the module to run in.
Passing arguments to the loaded module.
Exposing exports from the loaded module.
Module loaders typically are called module.LOADER_NAME
. The list of module loader components can be found in the list of Grafana Agent Flow [Components][].
Some module loaders may not support running modules with arguments or exports; refer to the documentation for the module loader you are using for more information.
[Component controller]: {{< relref "./component_controller.md" >}} [Components]: {{< relref "../reference/components/" >}}
Module sources
Modules are designed to be flexible, and can have their configuration retrieved from anywhere, such as:
The local filesystem
An S3 bucket
An HTTP endpoint
Each module loader component will support different ways of retrieving module sources. The most generic module loader component, module.string
, can load modules from the export of another Flow component:
Example module
This example module manages a pipeline which filters out debug- and info-level log lines which are given to it:
The module above can be saved to a file and then used as a processing step before writing logs to Loki: