Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Send logs to Azure Data Explorer (Kusto)
The Kusto output plugin allows to ingest your logs into an Azure Data Explorer cluster, via the Queued Ingestion mechanism. This output plugin can also be used to ingest logs into an Eventhouse cluster in Microsoft Fabric Real Time Analytics.
You can create an Azure Data Explorer cluster in one of the following ways:
You can create an Eventhouse cluster and a KQL database follow the following steps:
Fluent-Bit will use the application's credentials, to ingest data into your cluster.
Fluent-Bit ingests the event data into Kusto in a JSON format, that by default will include 3 properties:
log
- the actual event payload.
tag
- the event tag.
timestamp
- the event timestamp.
A table with the expected schema must exist in order for data to be ingested properly.
By default, Kusto will insert incoming ingestions into a table by inferring the mapped table columns, from the payload properties. However, this mapping can be customized by creatng a JSON ingestion mapping. The plugin can be configured to use an ingestion mapping via the ingestion_mapping_reference
configuration key.
tenant_id
Required - The tenant/domain ID of the AAD registered application.
client_id
Required - The client ID of the AAD registered application.
client_secret
ingestion_endpoint
Required - The cluster's ingestion endpoint, usually in the form `https://ingest-cluster_name.region.kusto.windows.net
database_name
Required - The database name.
table_name
Required - The table name.
ingestion_mapping_reference
log_key
Key name of the log content.
log
include_tag_key
If enabled, a tag is appended to output. The key name is used tag_key
property.
On
tag_key
The key name of tag. If include_tag_key
is false, This property is ignored.
tag
include_time_key
If enabled, a timestamp is appended to output. The key name is used time_key
property.
On
time_key
The key name of time. If include_time_key
is false, This property is ignored.
timestamp
Get started quickly with this configuration file:
If you get a 403 Forbidden
error response, make sure that:
You provided the correct AAD registered application credentials.
You authorized the application to ingest into your database or table.
Send logs to Amazon Kinesis Streams
In order to send records into Amazon Kinesis Data Streams, you can run the plugin from the command line or through the configuration file:
The kinesis_streams plugin, can read the parameters from the command line through the -p argument (property), e.g:
In your main configuration file append the following Output section:
The following AWS IAM permissions are required to use this plugin:
Fluent Bit 1.7 adds a new feature called workers
which enables outputs to have dedicated threads. This kinesis_streams
plugin fully supports workers.
Example:
If you enable a single worker, you are enabling a dedicated thread for your Kinesis output. We recommend starting with without workers, evaluating the performance, and then adding workers one at a time until you reach your desired/needed throughput. For most users, no workers or a single worker will be sufficient.
Amazon distributes a container image with Fluent Bit and these plugins.
Our images are available in Amazon ECR Public Gallery. You can download images with different tags by following command:
For example, you can pull the image with latest version by:
If you see errors for image pull limits, try log into public ECR with your AWS credentials:
You can use our SSM Public Parameters to find the Amazon ECR image URI in your region:
Required - The client secret of the AAD registered application ().
Optional - The name of a that will be used to map the ingested payload into the table columns.
The Amazon Kinesis Data Streams output plugin allows to ingest your records into the service.
This is the documentation for the core Fluent Bit Kinesis plugin written in C. It has all the core features of the Golang Fluent Bit plugin released in 2019. The Golang plugin was named kinesis
; this new high performance and highly efficient kinesis plugin is called kinesis_streams
to prevent conflicts/confusion.
Currently, this kinesis_streams
plugin will always use a random partition key when uploading records to kinesis via the .
See for details on how AWS credentials are fetched.
You can check the for more details.
For more see .
region
The AWS region.
stream
The name of the Kinesis Streams Delivery stream that you want log records sent to.
time_key
Add the timestamp to the record under this key. By default the timestamp from Fluent Bit will not be added to records sent to Kinesis.
time_key_format
strftime compliant format string for the timestamp; for example, the default is '%Y-%m-%dT%H:%M:%S'. Supports millisecond precision with '%3N' and supports nanosecond precision with '%9N' and '%L'; for example, adding '%3N' to support millisecond '%Y-%m-%dT%H:%M:%S.%3N'. This option is used with time_key.
log_key
By default, the whole log record will be sent to Kinesis. If you specify a key name with this option, then only the value of that key will be sent to Kinesis. For example, if you are using the Fluentd Docker log driver, you can specify log_key log
and only the log message will be sent to Kinesis.
role_arn
ARN of an IAM role to assume (for cross account access).
endpoint
Specify a custom endpoint for the Kinesis API.
sts_endpoint
Custom endpoint for the STS API.
auto_retry_requests
Immediately retry failed requests to AWS services once. This option does not affect the normal Fluent Bit retry mechanism with backoff. Instead, it enables an immediate retry with no delay for networking errors, which may help improve throughput when there are transient/random networking issues. This option defaults to true
.
external_id
Specify an external ID for the STS API, can be used with the role_arn parameter if your role requires an external ID.
profile
AWS profile name to use. Defaults to default
.
Counter is a very simple plugin that counts how many records it's getting upon flush time. Plugin output is as follows:
You can run the plugin from the command line or through the configuration file:
From the command line you can let Fluent Bit count up a data with the following options:
In your main configuration file append the following Input & Output sections:
Once Fluent Bit is running, you will see the reports in the output interface similar to this:
Official and Microsoft Certified Azure Storage Blob connector
The Azure Blob output plugin allows ingesting your records into Azure Blob Storage service. This connector is designed to use the Append Blob and Block Blob API.
Our plugin works with the official Azure Service and also can be configured to be used with a service emulator such as Azurite.
Before getting started, make sure you already have an Azure Storage account. As a reference, the following link explains step-by-step how to set up your account:
We expose different configuration properties. The following table lists all the options available, and the next section has specific configuration details for the official service or the emulator.
account_name
Azure Storage account name. This configuration property is mandatory
auth_type
Specify the type to authenticate against the service. Fluent Bit supports key
and sas
.
key
shared_key
Specify the Azure Storage Shared Key to authenticate against the service. This configuration property is mandatory when auth_type
is key
.
sas_token
Specify the Azure Storage shared access signatures to authenticate against the service. This configuration property is mandatory when auth_type
is sas
.
container_name
Name of the container that will contain the blobs. This configuration property is mandatory
blob_type
Specify the desired blob type. Fluent Bit supports appendblob
and blockblob
.
appendblob
auto_create_container
If container_name
does not exist in the remote service, enabling this option will handle the exception and auto-create the container.
on
path
Optional path to store your blobs. If your blob name is myblob
, you can specify sub-directories where to store it using path, so setting path to /logs/kubernetes
will store your blob in /logs/kubernetes/myblob
.
emulator_mode
off
endpoint
tls
Enable or disable TLS encryption. Note that Azure service requires this to be turned on.
off
As mentioned above, you can either deliver records to the official service or an emulator. Below we have an example for each use case.
The following configuration example generates a random message with a custom tag:
After you run the configuration file above, you will be able to query the data using the Azure Storage Explorer. The example above will generate the following content in the explorer:
The quickest way to get started is to install Azurite using npm:
then run the service:
Azurite comes with a default account_name
and shared_key
, so make sure to use the specific values provided in the example below (do an exact copy/paste):
after running that Fluent Bit configuration you will see the data flowing into Azurite:
Send logs and metrics to Amazon CloudWatch
The Amazon CloudWatch output plugin allows to ingest your records into the CloudWatch Logs service. Support for CloudWatch Metrics is also provided via EMF.
This is the documentation for the core Fluent Bit CloudWatch plugin written in C. It can replace the aws/amazon-cloudwatch-logs-for-fluent-bit Golang Fluent Bit plugin released last year. The Golang plugin was named cloudwatch
; this new high performance CloudWatch plugin is called cloudwatch_logs
to prevent conflicts/confusion. Check the amazon repo for the Golang plugin for details on the deprecation/migration plan for the original plugin.
See here for details on how AWS credentials are fetched.
region
The AWS region.
log_group_name
The name of the CloudWatch Log Group that you want log records sent to.
log_group_template
log_stream_name
The name of the CloudWatch Log Stream that you want log records sent to.
log_stream_prefix
Prefix for the Log Stream name. The tag is appended to the prefix to construct the full log stream name. Not compatible with the log_stream_name option.
log_stream_template
log_key
By default, the whole log record will be sent to CloudWatch. If you specify a key name with this option, then only the value of that key will be sent to CloudWatch. For example, if you are using the Fluentd Docker log driver, you can specify log_key log
and only the log message will be sent to CloudWatch.
log_format
role_arn
ARN of an IAM role to assume (for cross account access).
auto_create_group
Automatically create the log group. Valid values are "true" or "false" (case insensitive). Defaults to false.
log_retention_days
If set to a number greater than zero, and newly create log group's retention policy is set to this many days. Valid values are: [1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653]
endpoint
Specify a custom endpoint for the CloudWatch Logs API.
metric_namespace
An optional string representing the CloudWatch namespace for the metrics. See Metrics Tutorial
section below for a full configuration.
metric_dimensions
sts_endpoint
Specify a custom STS endpoint for the AWS STS API.
profile
Option to specify an AWS Profile for credentials. Defaults to default
auto_retry_requests
Immediately retry failed requests to AWS services once. This option does not affect the normal Fluent Bit retry mechanism with backoff. Instead, it enables an immediate retry with no delay for networking errors, which may help improve throughput when there are transient/random networking issues. This option defaults to true
.
external_id
Specify an external ID for the STS API, can be used with the role_arn parameter if your role requires an external ID.
In order to send records into Amazon Cloudwatch, you can run the plugin from the command line or through the configuration file:
The cloudwatch plugin, can read the parameters from the command line through the -p argument (property), e.g:
In your main configuration file append the following Output section:
The following AWS IAM permissions are required to use this plugin:
Fluent Bit 1.7 adds a new feature called workers
which enables outputs to have dedicated threads. This cloudwatch_logs
plugin has partial support for workers in Fluent Bit 2.1.11 and prior. 2.1.11 and prior, the plugin can support a single worker; enabling multiple workers will lead to errors/indeterminate behavior. Starting from Fluent Bit 2.1.12, the cloudwatch_logs
plugin added full support for workers, meaning that more than one worker can be configured.
Example:
If you enable workers, you are enabling one or more dedicated threads for your CloudWatch output. We recommend starting with 1 worker, evaluating the performance, and then enabling more workers if needed. For most users, the plugin can provide sufficient throughput with 0 or 1 workers.
Sometimes, you may want the log group or stream name to be based on the contents of the log record itself. This plugin supports templating log group and stream names using Fluent Bit record_accessor syntax.
Here is an example usage, for a common use case- templating log group and stream names based on Kubernetes metadata.
Recall that the kubernetes filter can add metadata which will look like the following:
Using record_accessor, we can build a template based on this object.
Here is our output configuration:
With the above kubernetes metadata, the log group name will be application-logs-ip-10-1-128-166.us-east-2.compute.internal.my-namespace
. And the log stream name will be myapp-5468c5d4d7-n2swr.myapp
.
If the kubernetes structure is not found in the log record, then the log_group_name
and log_stream_prefix
will be used instead, and Fluent Bit will log an error like:
Notice in the example above, that the template values are separated by dot characters. This is important; the Fluent Bit record_accessor library has a limitation in the characters that can separate template variables- only dots and commas (.
and ,
) can come after a template variable. This is because the templating library must parse the template and determine the end of a variable.
Assume that your log records contain the metadata keys container_name
and task
. The following would be invalid templates because the two template variables are not separated by commas or dots:
$task-$container_name
$task/$container_name
$task_$container_name
$taskfooo$container_name
However, the following are valid:
$task.$container_name
$task.resource.$container_name
$task.fooo.$container_name
And the following are valid since they only contain one template variable with nothing after it:
fooo$task
fooo____$task
fooo/bar$container_name
Fluent Bit has different input plugins (cpu, mem, disk, netif) to collect host resource usage metrics. cloudwatch_logs
output plugin can be used to send these host metrics to CloudWatch in Embedded Metric Format (EMF). If data comes from any of the above mentioned input plugins, cloudwatch_logs
output plugin will convert them to EMF format and sent to CloudWatch as JSON log. Additionally, if we set json/emf
as the value of log_format
config option, CloudWatch will extract custom metrics from embedded JSON payload.
Note: Right now, only cpu
and mem
metrics can be sent to CloudWatch.
For using the mem
input plugin and sending memory usage metrics to CloudWatch, we can consider the following example config file. Here, we use the aws
filter which adds ec2_instance_id
and az
(availability zone) to the log records. Later, in the output config section, we set ec2_instance_id
as our metric dimension.
The following config will set two dimensions to all of our metrics- ec2_instance_id
and az
.
Amazon distributes a container image with Fluent Bit and these plugins.
github.com/aws/aws-for-fluent-bit
Our images are available in Amazon ECR Public Gallery. You can download images with different tags by following command:
For example, you can pull the image with latest version by:
If you see errors for image pull limits, try log into public ECR with your AWS credentials:
You can check the Amazon ECR Public official doc for more details
You can use our SSM Public Parameters to find the Amazon ECR image URI in your region:
For more see the AWS for Fluent Bit github repo.
Send logs, data, metrics to Amazon S3
The Amazon S3 output plugin allows you to ingest your records into the S3 cloud object store.
The plugin can upload data to S3 using the multipart upload API or using S3 PutObject. Multipart is the default and is recommended; Fluent Bit will stream data in a series of 'parts'. This limits the amount of data it has to buffer on disk at any point in time. By default, every time 5 MiB of data have been received, a new 'part' will be uploaded. The plugin can create files up to gigabytes in size from many small chunks/parts using the multipart API. All aspects of the upload process are configurable using the configuration options.
The plugin allows you to specify a maximum file size, and a timeout for uploads. A file will be created in S3 when the max size is reached, or the timeout is reached- whichever comes first.
Records are stored in files in S3 as newline delimited JSON.
See here for details on how AWS credentials are fetched.
NOTE: The Prometheus success/retry/error metrics values outputted by Fluent Bit's built-in http server are meaningless for the S3 output. This is because S3 has its own buffering and retry mechanisms. The Fluent Bit AWS S3 maintainers apologize for this feature gap; you can track our progress fixing it on GitHub.
region
The AWS region of your S3 bucket
us-east-1
bucket
S3 Bucket name
None
json_date_key
Specify the name of the time key in the output record. To disable the time key just set the value to false
.
date
json_date_format
Specify the format of the date. Supported formats are double, epoch, iso8601 (eg: 2018-05-30T09:39:52.000681Z) and java_sql_timestamp (eg: 2018-05-30 09:39:52.000681)
iso8601
total_file_size
Specifies the size of files in S3. Minimum size is 1M. With use_put_object On
the maximum size is 1G. With multipart upload mode, the maximum size is 50G.
100M
upload_chunk_size
The size of each 'part' for multipart uploads. Max: 50M
5,242,880 bytes
upload_timeout
Whenever this amount of time has elapsed, Fluent Bit will complete an upload and create a new file in S3. For example, set this value to 60m and you will get a new file every hour.
10m
store_dir
Directory to locally buffer data before sending. When multipart uploads are used, data will only be buffered until the upload_chunk_size
is reached. S3 will also store metadata about in progress multipart uploads in this directory; this allows pending uploads to be completed even if Fluent Bit stops and restarts. It will also store the current $INDEX value if enabled in the S3 key format so that the $INDEX can keep incrementing from its previous value after Fluent Bit restarts.
/tmp/fluent-bit/s3
store_dir_limit_size
The size of the limitation for disk usage in S3. Limit the amount of s3 buffers in the store_dir
to limit disk usage. Note: Use store_dir_limit_size
instead of storage.total_limit_size
which can be used to other plugins, because S3 has its own buffering system.
0, which means unlimited
s3_key_format
Format string for keys in S3. This option supports a UUID, strftime time formatters, a syntax for selecting parts of the Fluent log tag using a syntax inspired by the rewrite_tag filter. Add $UUID in the format string to insert a random string. Add $INDEX in the format string to insert an integer that increments each upload. The $INDEX value will be saved in the store_dir so that if Fluent Bit restarts the value will keep incrementing from the previous run. Add $TAG in the format string to insert the full log tag; add $TAG[0] to insert the first part of the tag in the s3 key. The tag is split into “parts” using the characters specified with the s3_key_format_tag_delimiters
option. Add extension directly after the last piece of the format string to insert a key suffix. If you want to specify a key suffix and you are in use_put_object
mode, you must specify $UUID as well. More explanations can be found in the S3 Key Format explainer section further down in this document. See the in depth examples and tutorial in the documentation. Time in s3_key is the timestamp of the first record in the S3 file.
/fluent-bit-logs/$TAG/%Y/%m/%d/%H/%M/%S
s3_key_format_tag_delimiters
A series of characters which will be used to split the tag into 'parts' for use with the s3_key_format option. See the in depth examples and tutorial in the documentation.
.
static_file_path
Disables behavior where UUID string is automatically appended to end of S3 key name when $UUID is not provided in s3_key_format. $UUID, time formatters, $TAG, and other dynamic key formatters all work as expected while this feature is set to true.
false
use_put_object
Use the S3 PutObject API, instead of the multipart upload API. When this option is on, key extension is only available when $UUID is specified in s3_key_format
. If $UUID is not included, a random string will be appended at the end of the format string and the key extension cannot be customized in this case.
false
role_arn
ARN of an IAM role to assume (ex. for cross account access).
None
endpoint
Custom endpoint for the S3 API. An endpoint can contain scheme and port.
None
sts_endpoint
Custom endpoint for the STS API.
None
profile
Option to specify an AWS Profile for credentials.
default
canned_acl
None
compression
Compression type for S3 objects. 'gzip' is currently the only supported value by default. If Apache Arrow support was enabled at compile time, you can also use 'arrow'. For gzip compression, the Content-Encoding HTTP Header will be set to 'gzip'. Gzip compression can be enabled when use_put_object
is 'on' or 'off' (PutObject and Multipart). Arrow compression can only be enabled with use_put_object On
.
None
content_type
A standard MIME type for the S3 object; this will be set as the Content-Type HTTP header.
None
send_content_md5
Send the Content-MD5 header with PutObject and UploadPart requests, as is required when Object Lock is enabled.
false
auto_retry_requests
Immediately retry failed requests to AWS services once. This option does not affect the normal Fluent Bit retry mechanism with backoff. Instead, it enables an immediate retry with no delay for networking errors, which may help improve throughput when there are transient/random networking issues.
true
log_key
By default, the whole log record will be sent to S3. If you specify a key name with this option, then only the value of that key will be sent to S3. For example, if you are using Docker, you can specify log_key log and only the log message will be sent to S3.
None
preserve_data_ordering
Normally, when an upload request fails, there is a high chance for the last received chunk to be swapped with a later chunk, resulting in data shuffling. This feature prevents this shuffling by using a queue logic for uploads.
true
storage_class
None
retry_limit
Integer value to set the maximum number of retries allowed. Note: this configuration is released since version 1.9.10 and 2.0.1. For previous version, the number of retries is 5 and is not configurable.
1
external_id
Specify an external ID for the STS API, can be used with the role_arn parameter if your role requires an external ID.
None
To skip TLS verification, set tls.verify
as false
. For more details about the properties available and general configuration, please refer to the TLS/SSL section.
The plugin requires the following AWS IAM permissions:
The s3 output plugin is special because its use case is to upload files of non-trivial size to an Amazon S3 bucket. This is in contrast to most other outputs which send many requests to upload data in batches of a few Megabytes or less.
When Fluent Bit recieves logs, it stores them in chunks, either in memory or the filesystem depending on your settings. A chunk is usually around 2 MB in size. Fluent Bit sends the chunks in order to each output that matches their tag. Most outputs then send the chunk immediately to their destination. A chunk is sent to the output's "flush callback function", which must return one of FLB_OK
, FLB_RETRY
, or FLB_ERROR
. Fluent Bit keeps count of the return values from each outputs "flush callback function"; these counters are the data source for Fluent Bit's error, retry, and success metrics available in prometheus format via its monitoring interface.
The S3 output plugin is a Fluent Bit output plugin and thus it conforms to the Fluent Bit output plugin specification. However, since the S3 use case is to upload large files, generally much larger than 2 MB, its behavior is different. The S3 "flush callback function" simply buffers the incoming chunk to the filesystem, and returns an FLB_OK
. Consequently, the prometheus metrics available via the Fluent Bit http server are meaningless for S3. In addition, the storage.total_limit_size
parameter is not meaningful for S3 since it has its own buffering system in the store_dir
. Instead, use store_dir_limit_size
. Finally, S3 always requires a write-able filesystem; running Fluent Bit on a read-only filesystem will not work with the S3 output.
S3 uploads are primarily initiated via the S3 "timer callback function", which runs separately from its "flush callback function". Because S3 has its own system of buffering and its own callback to upload data, the normal sequential data ordering of chunks provided by the Fluent Bit engine may be compromised. Consequently, S3 has the presevere_data_ordering
option which will ensure data is uploaded in the original order it was collected by Fluent Bit.
The HTTP Monitoring interface output metrics are not meaningful for S3: AWS understands that this is non-ideal; we have opened an issue with a design that will allow S3 to manage its own output metrics.
You must use store_dir_limit_size
to limit the space on disk used by S3 buffer files.
The original ordering of data inputted to Fluent Bit may not be preserved unless you enable preserve_data_ordering On
.
In Fluent Bit, all logs have an associated tag. The s3_key_format
option lets you inject the tag into the s3 key using the following syntax:
$TAG
=> the full tag
$TAG[n]
=> the nth part of the tag (index starting at zero). This syntax is copied from the rewrite tag filter. By default, “parts” of the tag are separated with dots, but you can change this with s3_key_format_tag_delimiters
.
In the example below, assume the date is January 1st, 2020 00:00:00 and the tag associated with the logs in question is my_app_name-logs.prod
.
With the delimiters as . and -, the tag will be split into parts as follows:
$TAG[0]
= my_app_name
$TAG[1]
= logs
$TAG[2]
= prod
So the key in S3 will be /prod/my_app_name/2020/01/01/00/00/00/bgdHN1NM.gz
.
The Fluent Bit S3 output was designed to ensure that previous uploads will never be over-written by a subsequent upload. Consequently, the s3_key_format
supports time formatters, $UUID
, and $INDEX
. $INDEX
is special because it is saved in the store_dir
; if you restart Fluent Bit with the same disk, then it can continue incrementing the index from its last value in the previous run.
For files uploaded with the PutObject API, the S3 output requires that a unique random string be present in the S3 key. This is because many of the use cases for PutObject uploads involve a short time period between uploads such that a timestamp in the S3 key may not be unique enough between uploads. For example, if you only specify minute granularity timestamps in the S3 key, with a small upload size, it is possible to have two uploads that have timestamps set in the same minute. This "requirement" can be disabled with static_file_path On
.
There are three cases where the PutObject API is used:
When you explicitly set use_put_object On
On startup when the S3 output finds old buffer files in the store_dir
from a previous run and attempts to send all of them at once.
On shutdown, when to prevent data loss the S3 output attempts to send all currently buffered data at once.
Consequently, you should always specify $UUID
somewhere in your S3 key format. Otherwise, if the PutObject API is used, S3 will append a random 8 character UUID to the end of your S3 key. This means that a file extension set at the end of an S3 key will have the random UUID appended to it. This behavior can be disabled with static_file_path On
.
Let's walk through this via an example. First case, we attempt to set a .gz
extension without specifying $UUID
.
In the case where pending data is uploaded on shutdown, if the tag was app
, the S3 key in the S3 bucket might be:
The S3 output appended a random string to the "extension", since this upload on shutdown used the PutObject API.
There are two ways of disabling this behavior. Option 1, use static_file_path
:
Option 2, explicitly define where the random UUID will go in the S3 key format:
The store_dir
is used to temporarily store data before it is uploaded. If Fluent Bit is stopped suddenly it will try to send all data and complete all uploads before it shuts down. If it can not send some data, on restart it will look in the store_dir
for existing data and will try to send it.
Multipart uploads are ideal for most use cases because they allow the plugin to upload data in small chunks over time. For example, 1 GB file can be created from 200 5MB chunks. While the file size in S3 will be 1 GB, only 5 MB will be buffered on disk at any one point in time.
There is one minor drawback to multipart uploads- the file and data will not be visible in S3 until the upload is completed with a CompleteMultipartUpload call. The plugin will attempt to make this call whenever Fluent Bit is shut down to ensure your data is available in s3. It will also store metadata about each upload in the store_dir
, ensuring that uploads can be completed when Fluent Bit restarts (assuming it has access to persistent disk and the store_dir
files will still be present on restart).
If you run Fluent Bit in an environment without persistent disk, or without the ability to restart Fluent Bit and give it access to the data stored in the store_dir
from previous executions- some considerations apply. This might occur if you run Fluent Bit on AWS Fargate.
In these situations, we recommend using the PutObject API, and sending data frequently, to avoid local buffering as much as possible. This will limit data loss in the event Fluent Bit is killed unexpectedly.
The following settings are recommended for this use case:
With use_put_object Off
(default), S3 will attempt to send files using multipart uploads. For each file, S3 first calls CreateMultipartUpload, then a series of calls to UploadPart for each fragment (targeted to be upload_chunk_size
bytes), and finally CompleteMultipartUpload to create the final file in S3.
S3 requires each UploadPart fragment to be at least 5,242,880 bytes, otherwise the upload is rejected.
Consequently, the S3 output must sometimes fallback to the PutObject API.
Uploads are triggered by three settings:
total_file_size
and upload_chunk_size
: When S3 has buffered data in the store_dir
that meets the desired total_file_size
(for use_put_object On
) or the upload_chunk_size
(for Multipart), it will trigger an upload operation.
upload_timeout
: Whenever locally buffered data has been present on the filesystem in the store_dir
longer than the configured upload_timeout
, it will be sent. This happens regardless of whether or not the desired byte size has been reached. Consequently, if you configure a small upload_timeout
, your files may be smaller than the total_file_size
. The timeout is evaluated against the time at which S3 started buffering data for each unqiue tag (that is, the time when new data was buffered for the unique tag after the last upload). The timeout is also evaluated against the CreateMultipartUpload time, so a multipart upload will be completed after upload_timeout
has elapsed, even if the desired size has not yet been reached.
If your upload_timeout
triggers an upload before the pending buffered data reaches the upload_chunk_size
, it may be too small for a multipart upload. S3 will consequently fallback to use the PutObject API.
When you enable compression, S3 applies the compression algorithm at send time. The size settings noted above trigger uploads based on the size of buffered data, not the final compressed size. Consequently, it is possible that after compression, buffered data no longer meets the required minimum S3 UploadPart size. If this occurs, you will see a log message like:
If you encounter this frequently, use the numbers in the messages to guess your compression factor. For example, in this case, the buffered data was reduced from 5,630,650 bytes to 1,063,320 bytes. The compressed size is 1/5 the actual data size, so configuring upload_chunk_size 30M
should ensure each part is large enough after compression to be over the min required part size of 5,242,880 bytes.
The S3 API allows the last part in an upload to be less than the 5,242,880 byte minimum. Therefore, if a part is too small for an existing upload, the S3 output will upload that part and then complete the upload.
The upload_timeout
is evaluated against the CreateMultipartUpload time. So a multipart upload will be completed after upload_timeout
has elapsed, even if the desired size has not yet been reached.
When CreateMultipartUpload is called, an UploadID
is returned. S3 stores these IDs for active uploads in the store_dir
. Until CompleteMultipartUpload is called, the uploaded data will not be visible in S3.
On shutdown, S3 output will attempt to complete all pending uploads. If it fails to complete an upload, the ID will remain buffered in the store_dir
in a directory called multipart_upload_metadata
. If you restart the S3 output with the same store_dir
it will discover the old UploadIDs and complete the pending uploads. The S3 documentation also has suggestions on discovering and deleting/completing dangling uploads in your buckets.
Fluent Bit 1.7 adds a new feature called workers
which enables outputs to have dedicated threads. This s3
plugin has partial support for workers. The plugin can only support a single worker; enabling multiple workers will lead to errors/indeterminate behavior.
Example:
If you enable a single worker, you are enabling a dedicated thread for your S3 output. We recommend starting without workers, evaluating the performance, and then enabling a worker if needed. For most users, the plugin can provide sufficient throughput without workers.
MinIO is a high-performance, S3 compatible object storage and you can build your app with S3 functionality without S3.
Assume you run a MinIO server at localhost:9000, and create a bucket of your-bucket
by referring the client docs.
Example:
Then, the records will be stored into the MinIO server.
In order to send records into Amazon S3, you can run the plugin from the command line or through the configuration file.
The s3 plugin, can read the parameters from the command line through the -p argument (property), e.g:
In your main configuration file append the following Output section:
An example that using PutObject instead of multipart:
Amazon distributes a container image with Fluent Bit and this plugins.
github.com/aws/aws-for-fluent-bit
Our images are available in Amazon ECR Public Gallery. You can download images with different tags by following command:
For example, you can pull the image with latest version by:
If you see errors for image pull limits, try log into public ECR with your AWS credentials:
You can check the Amazon ECR Public official doc for more details.
You can use our SSM Public Parameters to find the Amazon ECR image URI in your region:
For more see the AWS for Fluent Bit github repo.
Starting from Fluent Bit v1.8, the Amazon S3 plugin includes the support for Apache Arrow. The support is currently not enabled by default, as it depends on a shared version of libarrow
as the prerequisite.
To use this feature, FLB_ARROW
must be turned on at compile time:
Once compiled, Fluent Bit can upload incoming data to S3 in Apache Arrow format. For example:
As shown in this example, setting Compression
to arrow
makes Fluent Bit to convert payload into Apache Arrow format.
The stored data is very easy to load, analyze and process using popular data processing tools (such as Python pandas, Apache Spark and Tensorflow). The following code uses pyarrow
to analyze the uploaded data:
Send logs, metrics to Azure Log Analytics
In order to insert records into an Azure Log Analytics instance, you can run the plugin from the command line or through the configuration file:
The azure plugin, can read the parameters from the command line in two ways, through the -p argument (property), e.g:
In your main configuration file append the following Input & Output sections:
Send logs to Elasticsearch (including Amazon OpenSearch Service)
The write_operation can be any of:
Please note, Id_Key
or Generate_ID
is required in update, and upsert scenario.
In order to insert records into a Elasticsearch service, you can run the plugin from the command line or through the configuration file:
The es plugin, can read the parameters from the command line in two ways, through the -p argument (property) or setting them directly through the service URI. The URI format is the following:
Using the format specified, you could start Fluent Bit through:
which is similar to do:
Some input plugins may generate messages where the field names contains dots, since Elasticsearch 2.0 this is not longer allowed, so the current es plugin replaces them with an underscore, e.g:
becomes
Since Elasticsearch 6.0, you cannot create multiple types in a single index. This means that you cannot set up your configuration as below anymore.
If you see an error message like below, you'll need to fix your configuration to use a single type on each index.
Rejecting mapping update to [search] as the final mapping would have more than 1 type
The Amazon OpenSearch Service adds an extra security layer where HTTP requests must be signed with AWS Sigv4. Fluent Bit v1.5 introduced full support for Amazon OpenSearch Service with IAM Authentication.
Example configuration:
Notice that the Port
is set to 443
, tls
is enabled, and AWS_Region
is set.
Example configuration:
Since v1.8.2, Fluent Bit started using create
method (instead of index
) for data submission. This makes Fluent Bit compatible with Datastream introduced in Elasticsearch 7.9.
If you see action_request_validation_exception
errors on your pipeline with Fluent Bit >= v1.8.2, you can fix it up by turning on Generate_ID
as follows:
Elastic Cloud is now on version 8 so the type option must be removed by setting Suppress_Type_Name On
as indicated above.
Without this you will see errors like:
The following snippet demonstrates using the namespace name as extracted by the kubernetes
filter as logstash prefix:
For records that do nor have the field kubernetes.namespace_name
, the default prefix, logstash
will be used.
This plugin offers two different transports and modes:
Forward (TCP): It uses a plain TCP connection.
Secure Forward (TLS): when TLS is enabled, the plugin switch to Secure Forward mode.
The following parameters are mandatory for either Forward for Secure Forward modes:
That configuration file specifies that it will listen for TCP connections on the port 24224 through the forward input type. Then for every message with a fluent_bit TAG, will print the message to the standard output.
DISCLAIMER: the following example does not consider the generation of certificates for best practice on production environments.
Paste this content in a file called flb.conf:
Paste this content in a file called fld.conf:
If you're using Fluentd v1, set up it as below:
Start Fluentd:
Start Fluent Bit:
After five seconds, Fluent Bit will write records to Fluentd. In Fluentd output you will see a message like this:
If you want to send data to an Azure emulator service like , enable this option so the plugin will format the requests to the expected format.
If you are using an emulator, this option allows you to specify the absolute HTTP address of such service. e.g: .
Template for Log Group name using Fluent Bit syntax. This field is optional and if configured it overrides the log_group_name
. If the template translation fails, an error is logged and the log_group_name
(which is still required) is used instead. See the tutorial below for an example.
Template for Log Stream name using Fluent Bit syntax. This field is optional and if configured it overrides the other log stream options. If the template translation fails, an error is logged and the log_stream_name or log_stream_prefix are used instead (and thus one of those fields is still required to be configured). See the tutorial below for an example.
An optional parameter that can be used to tell CloudWatch the format of the data. A value of json/emf enables CloudWatch to extract custom metrics embedded in a JSON payload. See the .
A list of lists containing the dimension keys that will be applied to all metrics. The values within a dimension set MUST also be members on the root-node. For more information about dimensions, see and . In the fluent-bit config, metric_dimensions is a comma and semicolon separated string. If you have only one list of dimensions, put the values as a comma separated string. If you want to put list of lists, use the list as semicolon separated strings. For example, if you set the value as 'dimension_1,dimension_2;dimension_3', we will convert it as [[dimension_1, dimension_2],[dimension_3]]
for S3 objects.
Specify the for S3 objects. If this option is not specified, objects will be stored with the default 'STANDARD' storage class.
The Datadog output plugin allows to ingest your logs into .
Before you begin, you need a , a , and you need to .
If you get a 403 Forbidden
error response, double check that you have a valid and that you have .
Azure output plugin allows to ingest your records into service.
To get more details about how to setup Azure Log Analytics, please refer to the following documentation:
Another example using the Log_Type_Key
with , which will read the table name (or event type) dynamically from kubernetes label app
, instead of Log_Type
:
The es output plugin, allows to ingest your records into an database. The following instructions assumes that you have a fully operational Elasticsearch service running in your environment.
The parameters index and type can be confusing if you are new to Elastic, if you have used a common relational database before, they can be compared to the database and table concepts. Also see
Elasticsearch output plugin supports TLS/SSL, for more details about the properties available and general configuration, please refer to the section.
In your main configuration file append the following Input & Output sections. You can visualize this configuration
For details, please read .
Fluent Bit v1.5 changed the default mapping type from flb_type
to _doc
, which matches the recommendation from Elasticsearch from version 6.2 forwards (). This doesn't work in Elasticsearch versions 5.6 through 6.1 (). Ensure you set an explicit map (such as doc
or flb_type
) in the configuration, as seen on the last line:
See for details on how AWS credentials are fetched.
Fluent Bit supports connecting to providing just the cloud_id
and the cloud_auth
settings. cloud_auth
uses the elastic
user and password provided when the cluster was created, for details refer to the .
Forward is the protocol used by to route messages between peers. The forward output plugin provides interoperability between and . There are no configuration steps required besides specifying where is located, which can be a local or a remote destination.
When using Secure Forward mode, the mode requires to be enabled. The following additional configuration parameters are available:
Before proceeding, make sure that is installed, if it's not the case please refer to the following document and go ahead with that.
Once is installed, create the following configuration file example that will allow us to stream data into it:
In one terminal launch specifying the new configuration file created:
Now that is ready to receive messages, we need to specify where the forward output plugin will flush the information using the following format:
If the TAG parameter is not set, the plugin will retain the tag. Keep in mind that TAG is important for routing rules inside .
Using the input plugin as an example we will flush CPU metrics to with tag fluent_bit:
Now on the side, you will see the CPU metrics gathered in the last seconds:
So we gathered metrics and flushed them out to properly.
Secure Forward aims to provide a secure channel of communication with the remote Fluentd service using .
Host
Required - The Datadog server where you are sending your logs.
http-intake.logs.datadoghq.com
TLS
Required - End-to-end security communications security protocol. Datadog recommends setting this to on
.
off
compress
Recommended - compresses the payload in GZIP format, Datadog supports and recommends setting this to gzip
.
apikey
Required - Your Datadog API key.
Proxy
Optional - Specify an HTTP Proxy. The expected format of this value is http://host:port. Note that https is not supported yet.
provider
To activate the remapping, specify configuration flag provider with value ecs
.
json_date_key
Date key name for output.
timestamp
include_tag_key
If enabled, a tag is appended to output. The key name is used tag_key
property.
false
tag_key
The key name of tag. If include_tag_key
is false, This property is ignored.
tagkey
dd_service
Recommended - The human readable name for your service generating the logs (e.g. the name of your application or database). If unset, Datadog will look for the service using Service Remapper."
dd_source
Recommended - A human readable name for the underlying technology of your service (e.g. postgres
or nginx
). If unset, Datadog will look for the source in the ddsource
attribute.
dd_tags
Optional - The tags you want to assign to your logs in Datadog. If unset, Datadog will look for the tags in the `ddtags' attribute.
dd_message_key
By default, the plugin searches for the key 'log' and remap the value to the key 'message'. If the property is set, the plugin will search the property name key.
Customer_ID
Customer ID or WorkspaceID string.
Shared_Key
The primary or the secondary Connected Sources client authentication key.
Log_Type
The name of the event type.
fluentbit
Log_Type_Key
If included, the value for this key will be looked upon in the record and if present, will over-write the log_type
. If not found then the log_type
value will be used.
Time_Key
Optional parameter to specify the key name where the timestamp will be stored.
@timestamp
Time_Generated
If enabled, the HTTP request header 'time-generated-field' will be included so Azure can override the timestamp with the key specified by 'time_key' option.
off
Host
IP address or hostname of the target Elasticsearch instance
127.0.0.1
Port
TCP port of the target Elasticsearch instance
9200
Path
Elasticsearch accepts new data on HTTP query path "/_bulk". But it is also possible to serve Elasticsearch behind a reverse proxy on a subpath. This option defines such path on the fluent-bit side. It simply adds a path prefix in the indexing HTTP POST URI.
Empty string
compress
Set payload compression mechanism. Option available is 'gzip'
Buffer_Size
Specify the buffer size used to read the response from the Elasticsearch HTTP service. This option is useful for debugging purposes where is required to read full responses, note that response size grows depending of the number of records inserted. To set an unlimited amount of memory set this value to False, otherwise the value must be according to the Unit Size specification.
512KB
Pipeline
Newer versions of Elasticsearch allows to setup filters called pipelines. This option allows to define which pipeline the database should use. For performance reasons is strongly suggested to do parsing and filtering on Fluent Bit side, avoid pipelines.
AWS_Auth
Enable AWS Sigv4 Authentication for Amazon OpenSearch Service
Off
AWS_Region
Specify the AWS region for Amazon OpenSearch Service
AWS_STS_Endpoint
Specify the custom sts endpoint to be used with STS API for Amazon OpenSearch Service
AWS_Role_ARN
AWS IAM Role to assume to put records to your Amazon cluster
AWS_External_ID
External ID for the AWS IAM Role specified with aws_role_arn
AWS_Service_Name
Service name to be used in AWS Sigv4 signature. For integration with Amazon OpenSearch Serverless, set to aoss
. See the FAQ section on Amazon OpenSearch Serverless for more information.
es
AWS_Profile
AWS profile name
default
Cloud_ID
If you are using Elastic's Elasticsearch Service you can specify the cloud_id of the cluster running. The Cloud ID string has the format <deployment_name>:<base64_info>
. Once decoded, the base64_info
string has the format <deployment_region>$<elasticsearch_hostname>$<kibana_hostname>
.
Cloud_Auth
Specify the credentials to use to connect to Elastic's Elasticsearch Service running on Elastic Cloud
HTTP_User
Optional username credential for Elastic X-Pack access
HTTP_Passwd
Password for user defined in HTTP_User
Index
Index name
fluent-bit
Type
Type name
_doc
Logstash_Format
Enable Logstash format compatibility. This option takes a boolean value: True/False, On/Off
Off
Logstash_Prefix
When Logstash_Format is enabled, the Index name is composed using a prefix and the date, e.g: If Logstash_Prefix is equals to 'mydata' your index will become 'mydata-YYYY.MM.DD'. The last string appended belongs to the date when the data is being generated.
logstash
Logstash_Prefix_Key
When included: the value of the key in the record will be evaluated as key reference and overrides Logstash_Prefix for index generation. If the key/value is not found in the record then the Logstash_Prefix option will act as a fallback. The parameter is expected to be a record accessor.
Logstash_Prefix_Separator
Set a separator between logstash_prefix and date.
-
Logstash_DateFormat
Time format (based on strftime) to generate the second part of the Index name.
%Y.%m.%d
Time_Key
When Logstash_Format is enabled, each record will get a new timestamp field. The Time_Key property defines the name of that field.
@timestamp
Time_Key_Format
When Logstash_Format is enabled, this property defines the format of the timestamp.
%Y-%m-%dT%H:%M:%S
Time_Key_Nanos
When Logstash_Format is enabled, enabling this property sends nanosecond precision timestamps.
Off
Include_Tag_Key
When enabled, it append the Tag name to the record.
Off
Tag_Key
When Include_Tag_Key is enabled, this property defines the key name for the tag.
_flb-key
Generate_ID
When enabled, generate _id
for outgoing records. This prevents duplicate records when retrying ES.
Off
Id_Key
If set, _id
will be the value of the key from incoming record and Generate_ID
option is ignored.
Write_Operation
The write_operation can be any of: create (default), index, update, upsert.
create
Replace_Dots
When enabled, replace field name dots with underscore, required by Elasticsearch 2.0-2.3.
Off
Trace_Output
Print all elasticsearch API request payloads to stdout (for diag only)
Off
Trace_Error
If elasticsearch return an error, print the elasticsearch API request and response (for diag only)
Off
Current_Time_Index
Use current time for index generation instead of message record
Off
Suppress_Type_Name
When enabled, mapping types is removed and Type
option is ignored. If using Elasticsearch 8.0.0 or higher - it no longer supports mapping types, so it shall be set to On.
Off
Workers
Enables dedicated thread(s) for this output. Default value is set since version 1.8.13. For previous versions is 0.
2
create (default)
adds new data - if the data already exists (based on its id), the op is skipped.
index
new data is added while existing data (based on its id) is replaced (reindexed).
update
updates existing data (based on its id). If no data is found, the op is skipped.
upsert
known as merge or insert if the data does not exist, updates if the data exists (based on its id).
Host
Target host where Fluent-Bit or Fluentd are listening for Forward messages.
127.0.0.1
Port
TCP Port of the target service.
24224
Time_as_Integer
Set timestamps in integer format, it enable compatibility mode for Fluentd v0.12 series.
False
Upstream
If Forward will connect to an Upstream instead of a simple host, this property defines the absolute path for the Upstream configuration file, for more details about this refer to the Upstream Servers documentation section.
Unix_Path
Specify the path to unix socket to send a Forward message. If set, Upstream
is ignored.
Tag
Overwrite the tag as we transmit. This allows the receiving pipeline start fresh, or to attribute source.
Send_options
Always send options (with "size"=count of messages)
False
Require_ack_response
Send "chunk"-option and wait for "ack" response from server. Enables at-least-once and receiving server can control rate of traffic. (Requires Fluentd v0.14.0+ server)
False
Compress
Set to "gzip" to enable gzip compression. Incompatible with Time_as_Integer=True and tags set dynamically using the Rewrite Tag filter. (Requires Fluentd v0.14.7+ server)
Workers
Enables dedicated thread(s) for this output. Default value is set since version 1.8.13. For previous versions is 0.
2
Shared_Key
A key string known by the remote Fluentd used for authorization.
Empty_Shared_Key
Use this option to connect to Fluentd with a zero-length secret.
False
Username
Specify the username to present to a Fluentd server that enables user_auth
.
Password
Specify the password corresponding to the username.
Self_Hostname
Default value of the auto-generated certificate common name (CN).
localhost
tls
Enable or disable TLS support
Off
tls.verify
Force certificate validation
On
tls.debug
Set TLS debug verbosity level. It accept the following values: 0 (No debug), 1 (Error), 2 (State change), 3 (Informational) and 4 Verbose
1
tls.ca_file
Absolute path to CA certificate file
tls.crt_file
Absolute path to Certificate file.
tls.key_file
Absolute path to private Key file.
tls.key_passwd
Optional password for tls.key_file file.
The file output plugin allows to write the data received through the input plugin to file.
The plugin supports the following configuration parameters:
Path
Directory path to store files. If not set, Fluent Bit will write the files on it's own positioned directory. note: this option was added on Fluent Bit v1.4.6
File
Set file name to store the records. If not set, the file name will be the tag associated with the records.
Format
The format of the file content. See also Format section. Default: out_file.
Mkdir
Recursively create output directory if it does not exist. Permissions set to 0755.
Workers
Enables dedicated thread(s) for this output. Default value is set since version 1.8.13. For previous versions is 0.
1
Output time, tag and json records. There is no configuration parameters for out_file.
Output the records as JSON (without additional tag
and timestamp
attributes). There is no configuration parameters for plain format.
Output the records as csv. Csv supports an additional configuration parameter.
Delimiter
The character to separate each data. Accepted values are "\t" (or "tab"), "space" or "comma". Other values are ignored and will use default silently. Default: ','
Output the records as LTSV. LTSV supports an additional configuration parameter.
Delimiter
The character to separate each pair. Default: '\t'(TAB)
Label_Delimiter
The character to separate label and the value. Default: ':'
Output the records using a custom format template.
Template
The format string. Default: '{time} {message}'
This accepts a formatting template and fills placeholders using corresponding values in a record.
For example, if you set up the configuration as below:
You will get the following output:
You can run the plugin from the command line or through the configuration file:
From the command line you can let Fluent Bit count up a data with the following options:
In your main configuration file append the following Input & Output sections:
BigQuery output plugin is an experimental plugin that allows you to stream records into Google Cloud BigQuery service. The implementation does not support the following, which would be expected in a full production version:
Data deduplication using insertId
.
Template tables using templateSuffix
.
Fluent Bit streams data into an existing BigQuery table using a service account that you specify. Therefore, before using the BigQuery output plugin, you must create a service account, create a BigQuery dataset and table, authorize the service account to write to the table, and provide the service account credentials to Fluent Bit.
To stream data into BigQuery, the first step is to create a Google Cloud service account for Fluent Bit:
Fluent Bit does not create datasets or tables for your data, so you must create these ahead of time. You must also grant the service account WRITER
permission on the dataset:
Within the dataset you will need to create a table for the data to reside in. You can follow the following instructions for creating your table. Pay close attention to the schema. It must match the schema of your output JSON. Unfortunately, since BigQuery does not allow dots in field names, you will need to use a filter to change the fields for many of the standard inputs (e.g, mem or cpu).
Fluent Bit BigQuery output plugin uses a JSON credentials file for authentication credentials. Download the credentials file by following these instructions:
Using identity federation, you can grant on-premises or multi-cloud workloads access to Google Cloud resources, without using a service account key. It can be used as a more secure alternative to service account credentials. Google Cloud's workload identity federation supports several identity providers (see documentation) but Fluent Bit BigQuery plugin currently supports Amazon Web Services (AWS) only.
You must configure workload identity federation in GCP before using it with Fluent Bit.
google_service_credentials
Absolute path to a Google Cloud credentials JSON file.
Value of the environment variable $GOOGLE_SERVICE_CREDENTIALS
project_id
The project id containing the BigQuery dataset to stream into.
The value of the project_id
in the credentials file
dataset_id
The dataset id of the BigQuery dataset to write into. This dataset must exist in your project.
table_id
The table id of the BigQuery table to write into. This table must exist in the specified dataset and the schema must match the output.
skip_invalid_rows
Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist.
Off
ignore_unknown_values
Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors.
Off
enable_workload_identity_federation
Enables workload identity federation as an alternative authentication method. Cannot be used with service account credentials file or environment variable. AWS is the only identity provider currently supported.
Off
aws_region
Used to construct a regional endpoint for AWS STS to verify AWS credentials obtained by Fluent Bit. Regional endpoints are recommended by AWS.
project_number
GCP project number where the identity provider was created. Used to construct the full resource name of the identity provider.
pool_id
GCP workload identity pool where the identity provider was created. Used to construct the full resource name of the identity provider.
provider_id
GCP workload identity provider. Used to construct the full resource name of the identity provider. Currently only AWS accounts are supported.
google_service_account
Email address of the Google service account to impersonate. The workload identity provider must have permissions to impersonate this service account, and the service account must have permissions to access Google BigQuery resources (e.g. write
access to tables)
See Google's official documentation for further details.
If you are using a Google Cloud Credentials File, the following configuration is enough to get you started:
The influxdb output plugin, allows to flush your records into a InfluxDB time series database. The following instructions assumes that you have a fully operational InfluxDB service running in your system.
Host
IP address or hostname of the target InfluxDB service
127.0.0.1
Port
TCP port of the target InfluxDB service
8086
Database
InfluxDB database name where records will be inserted
fluentbit
Bucket
InfluxDB bucket name where records will be inserted - if specified, database
is ignored and v2 of API is used
Org
InfluxDB organization name where the bucket is (v2 only)
fluent
Sequence_Tag
The name of the tag whose value is incremented for the consecutive simultaneous events.
_seq
HTTP_User
Optional username for HTTP Basic Authentication
HTTP_Passwd
Password for user defined in HTTP_User
HTTP_Token
Authentication token used with InfluDB v2 - if specified, both HTTP_User and HTTP_Passwd are ignored
HTTP_Header
Add a HTTP header key/value pair. Multiple headers can be set
Tag_Keys
Space separated list of keys that needs to be tagged
Auto_Tags
Automatically tag keys where value is string. This option takes a boolean value: True/False, On/Off.
Off
Uri
Custom URI endpoint
InfluxDB output plugin supports TLS/SSL, for more details about the properties available and general configuration, please refer to the TLS/SSL section.
In order to start inserting records into an InfluxDB service, you can run the plugin from the command line or through the configuration file:
The influxdb plugin, can read the parameters from the command line in two ways, through the -p argument (property) or setting them directly through the service URI. The URI format is the following:
Using the format specified, you could start Fluent Bit through:
In your main configuration file append the following Input & Output sections:
Basic example of Tag_Keys
usage:
With Auto_Tags=On in this example cause error, because every parsed field value type is string. Best usage of this option in metrics like record where one or more field value is not string typed.
Basic example of Tags_List_Key
usage:
Before to start Fluent Bit, make sure the target database exists on InfluxDB, using the above example, we will insert the data into a fluentbit database.
Log into InfluxDB console:
Create the database:
Check the database exists:
The following command will gather CPU metrics from the system and send the data to InfluxDB database every five seconds:
Note that all records coming from the cpu input plugin, have a tag cpu, this tag is used to generate the measurement in InfluxDB
From InfluxDB console, choose your database:
Now query some specific fields:
The CPU input plugin gather more metrics per CPU core, in the above example we just selected three specific metrics. The following query will give a full result:
Query tagged keys:
And now query method key values:
FlowCounter is the protocol to count records. The flowcounter output plugin allows to count up records and its size.
The plugin supports the following configuration parameters:
Unit
The unit of duration. (second/minute/hour/day)
minute
You can run the plugin from the command line or through the configuration file:
From the command line you can let Fluent Bit count up a data with the following options:
In your main configuration file append the following Input & Output sections:
Once Fluent Bit is running, you will see the reports in the output interface similar to this:
Send logs to Amazon Kinesis Firehose
The Amazon Kinesis Data Firehose output plugin allows to ingest your records into the Firehose service.
This is the documentation for the core Fluent Bit Firehose plugin written in C. It can replace the aws/amazon-kinesis-firehose-for-fluent-bit Golang Fluent Bit plugin released last year. The Golang plugin was named firehose
; this new high performance and highly efficient firehose plugin is called kinesis_firehose
to prevent conflicts/confusion.
See here for details on how AWS credentials are fetched.
region
The AWS region.
delivery_stream
The name of the Kinesis Firehose Delivery stream that you want log records sent to.
time_key
Add the timestamp to the record under this key. By default the timestamp from Fluent Bit will not be added to records sent to Kinesis.
time_key_format
strftime compliant format string for the timestamp; for example, the default is '%Y-%m-%dT%H:%M:%S'. Supports millisecond precision with '%3N' and supports nanosecond precision with '%9N' and '%L'; for example, adding '%3N' to support millisecond '%Y-%m-%dT%H:%M:%S.%3N'. This option is used with time_key.
log_key
By default, the whole log record will be sent to Firehose. If you specify a key name with this option, then only the value of that key will be sent to Firehose. For example, if you are using the Fluentd Docker log driver, you can specify log_key log
and only the log message will be sent to Firehose.
compression
Compression type for Firehose records. Each log record is individually compressed and sent to Firehose. 'gzip' and 'arrow' are the supported values. 'arrow' is only an available if Apache Arrow was enabled at compile time. Defaults to no compression.
role_arn
ARN of an IAM role to assume (for cross account access).
endpoint
Specify a custom endpoint for the Firehose API.
sts_endpoint
Custom endpoint for the STS API.
auto_retry_requests
Immediately retry failed requests to AWS services once. This option does not affect the normal Fluent Bit retry mechanism with backoff. Instead, it enables an immediate retry with no delay for networking errors, which may help improve throughput when there are transient/random networking issues. This option defaults to true
.
external_id
Specify an external ID for the STS API, can be used with the role_arn parameter if your role requires an external ID.
profile
AWS profile name to use. Defaults to default
.
In order to send records into Amazon Kinesis Data Firehose, you can run the plugin from the command line or through the configuration file:
The firehose plugin, can read the parameters from the command line through the -p argument (property), e.g:
In your main configuration file append the following Output section:
The following AWS IAM permissions are required to use this plugin:
Fluent Bit 1.7 adds a new feature called workers
which enables outputs to have dedicated threads. This kinesis_firehose
plugin fully supports workers.
Example:
If you enable a single worker, you are enabling a dedicated thread for your Firehose output. We recommend starting with without workers, evaluating the performance, and then adding workers one at a time until you reach your desired/needed throughput. For most users, no workers or a single worker will be sufficient.
Amazon distributes a container image with Fluent Bit and these plugins.
github.com/aws/aws-for-fluent-bit
Our images are available in Amazon ECR Public Gallery. You can download images with different tags by following command:
For example, you can pull the image with latest version by:
If you see errors for image pull limits, try log into public ECR with your AWS credentials:
You can check the Amazon ECR Public official doc for more details.
You can use our SSM Public Parameters to find the Amazon ECR image URI in your region:
For more see the AWS for Fluent Bit github repo.
The Chronicle output plugin allows ingesting security logs into Google Chronicle service. This connector is designed to send unstructured security logs.
Fluent Bit streams data into an existing Google Chronicle tenant using a service account that you specify. Therefore, before using the Chronicle output plugin, you must create a service account, create a Google Chronicle tenant, authorize the service account to write to the tenant, and provide the service account credentials to Fluent Bit.
To stream security logs into Google Chronicle, the first step is to create a Google Cloud service account for Fluent Bit:
Fluent Bit does not create a tenant of Google Chronicle for your security logs, so you must create this ahead of time.
Fluent Bit's Chronicle output plugin uses a JSON credentials file for authentication credentials. Download the credentials file by following these instructions:
google_service_credentials
Absolute path to a Google Cloud credentials JSON file.
Value of the environment variable $GOOGLE_SERVICE_CREDENTIALS
service_account_email
Account email associated with the service. Only available if no credentials file has been provided.
Value of environment variable $SERVICE_ACCOUNT_EMAIL
service_account_secret
Private key content associated with the service account. Only available if no credentials file has been provided.
Value of environment variable $SERVICE_ACCOUNT_SECRET
project_id
The project id containing the tenant of Google Chronicle to stream into.
The value of the project_id
in the credentials file
customer_id
The customer id to identify the tenant of Google Chronicle to stream into. The value of the customer_id
should be specified in the configuration file.
log_type
region
The GCP region in which to store security logs. Currently, there are several supported regions: US
, EU
, UK
, ASIA
. Blank is handled as US
.
log_key
By default, the whole log record will be sent to Google Chronicle. If you specify a key name with this option, then only the value of that key will be sent to Google Chronicle.
See Google's official documentation for further details.
If you are using a Google Cloud Credentials File, the following configuration is enough to get you started:
GELF is Graylog Extended Log Format. The GELF output plugin allows to send logs in GELF format directly to a Graylog input using TLS, TCP or UDP protocols.
The following instructions assumes that you have a fully operational Graylog server running in your environment.
According to GELF Payload Specification, there are some mandatory and optional fields which are used by Graylog in GELF format. These fields are determined with Gelf\*_Key_ key in this plugin.
Match
Pattern to match which tags of logs to be outputted by this plugin
Host
IP address or hostname of the target Graylog server
127.0.0.1
Port
The port that your Graylog GELF input is listening on
12201
Mode
The protocol to use (tls
, tcp
or udp
)
udp
Gelf_Short_Message_Key
A short descriptive message (MUST be set in GELF)
short_message
Gelf_Timestamp_Key
Your log timestamp (SHOULD be set in GELF)
timestamp
Gelf_Host_Key
Key which its value is used as the name of the host, source or application that sent this message. (MUST be set in GELF)
host
Gelf_Full_Message_Key
Key to use as the long message that can i.e. contain a backtrace. (Optional in GELF)
full_message
Gelf_Level_Key
level
Packet_Size
If transport protocol is udp
, you can set the size of packets to be sent.
1420
Compress
If transport protocol is udp
, you can set this if you want your UDP packets to be compressed.
true
GELF output plugin supports TLS/SSL, for more details about the properties available and general configuration, please refer to the TLS/SSL section.
If you're using Fluent Bit to collect Docker logs, note that Docker places your log in JSON under key log
. So you can set log
as your Gelf_Short_Message_Key
to send everything in Docker logs to Graylog. In this case, you need your log
value to be a string; so don't parse it using JSON parser.
The order of looking up the timestamp in this plugin is as follows:
Value of Gelf_Timestamp_Key
provided in configuration
Value of timestamp
key
If you're using Docker JSON parser, this parser can parse time and use it as timestamp of message. If all above fail, Fluent Bit tries to get timestamp extracted by your parser.
Timestamp does not set by Fluent Bit. In this case, your Graylog server will set it to the current timestamp (now).
Your log timestamp has to be in UNIX Epoch Timestamp format. If the Gelf_Timestamp_Key
value of your log is not in this format, your Graylog server will ignore it.
If you're using Fluent Bit in Kubernetes and you're using Kubernetes Filter Plugin, this plugin adds host
value to your log by default, and you don't need to add it by your own.
The version
of GELF message is also mandatory and Fluent Bit sets it to 1.1 which is the current latest version of GELF.
If you use udp
as transport protocol and set Compress
to true
, Fluent Bit compresses your packets in GZIP format, which is the default compression that Graylog offers. This can be used to trade more CPU load for saving network bandwidth.
If you're using Fluent Bit for shipping Kubernetes logs, you can use something like this as your configuration file:
By default, GELF tcp uses port 12201 and Docker places your logs in /var/log/containers
directory. The logs are placed in value of the log
key. For example, this is a log saved by Docker:
If you use Tail Input and use a Parser like the docker
parser shown above, it decodes your message and extracts data
(and any other present) field. This is how this log in stdout looks like after decoding:
Now, this is what happens to this log:
Fluent Bit GELF plugin adds "version": "1.1"
to it.
The Nest Filter, unnests fields inside log
key. In our example, it puts data
alongside stream
and time
.
We used this data
key as Gelf_Short_Message_Key
; so GELF plugin changes it to short_message
.
Kubernetes Filter adds host
name.
Timestamp is generated.
Any custom field (not present in GELF Payload Specification.) is prefixed by an underline.
Finally, this is what our Graylog server input sees:
Send logs to Azure Log Analytics using Logs Ingestion API with DCE and DCR
Azure Logs Ingestion plugin allows you ingest your records using Logs Ingestion API in Azure Monitor to supported Azure tables or to custom tables that you create.
The Logs ingestion API requires the following components:
A Data Collection Endpoint (DCE)
A Data Collection Rule (DCR) and
A Log Analytics Workspace
Note: According to this document, all resources should be in the same region.
To get more details about how to setup these components, please refer to the following documentations:
tenant_id
Required - The tenant ID of the AAD application.
client_id
Required - The client ID of the AAD application.
client_secret
dce_url
Required - Data Collection Endpoint(DCE) URL.
dcr_id
table_name
Required - The name of the custom log table (include the _CL
suffix as well if applicable)
time_key
Optional - Specify the key name where the timestamp will be stored.
@timestamp
time_generated
Optional - If enabled, will generate a timestamp and append it to JSON. The key name is set by the 'time_key' parameter.
true
compress
Optional - Enable HTTP payload gzip compression.
true
To send records into an Azure Log Analytics using Logs Ingestion API the following resources needs to be created:
A Data Collection Endpoint (DCE) for ingestion
A Data Collection Rule (DCR) for data transformation
Either an Azure tables or custom tables
An app registration with client secrets (for DCR access).
You can follow this guideline to setup the DCE, DCR, app registration and a custom table.
Use this configuration to quickly get started:
Setup your DCR transformation accordingly based on the json output from fluent-bit's pipeline (input, parser, filter, output).
The http output plugin allows to flush your records into a HTTP endpoint. For now the functionality is pretty basic and it issues a POST request with the data records in MessagePack (or JSON) format.
host
IP address or hostname of the target HTTP Server
127.0.0.1
http_User
Basic Auth Username
http_Passwd
Basic Auth Password. Requires HTTP_User to be set
AWS_Auth
Enable AWS SigV4 authentication
false
AWS_Service
Specify the AWS service code, i.e. es, xray, etc., of your service, used by SigV4 authentication. Usually can be found in the service endpoint's subdomains, protocol://service-code.region-code.amazonaws.com
AWS_Region
Specify the AWS region of your service, used by SigV4 authentication
AWS_STS_Endpoint
Specify the custom sts endpoint to be used with STS API, used with the AWS_Role_ARN option, used by SigV4 authentication
AWS_Role_ARN
AWS IAM Role to assume, used by SigV4 authentication
AWS_External_ID
External ID for the AWS IAM Role specified with aws_role_arn
, used by SigV4 authentication
port
TCP port of the target HTTP Server
80
Proxy
uri
Specify an optional HTTP URI for the target web server, e.g: /something
/
compress
Set payload compression mechanism. Option available is 'gzip'
format
Specify the data format to be used in the HTTP request body, by default it uses msgpack. Other supported formats are json, json_stream and json_lines and gelf.
msgpack
allow_duplicated_headers
Specify if duplicated headers are allowed. If a duplicated header is found, the latest key/value set is preserved.
true
log_response_payload
Specify if the response paylod should be logged or not.
true
header_tag
Specify an optional HTTP header field for the original message tag.
header
Add a HTTP header key/value pair. Multiple headers can be set.
json_date_key
Specify the name of the time key in the output record. To disable the time key just set the value to false
.
date
json_date_format
Specify the format of the date. Supported formats are double, epoch, iso8601 (eg: 2018-05-30T09:39:52.000681Z) and java_sql_timestamp (eg: 2018-05-30 09:39:52.000681)
double
gelf_timestamp_key
Specify the key to use for timestamp
in gelf format
gelf_host_key
Specify the key to use for the host
in gelf format
gelf_short_message_key
Specify the key to use as the short
message in gelf format
gelf_full_message_key
Specify the key to use for the full
message in gelf format
gelf_level_key
Specify the key to use for the level
in gelf format
body_key
Specify the key to use as the body of the request (must prefix with "$"). The key must contain either a binary or raw string, and the content type can be specified using headers_key (which must be passed whenever body_key is present). When this option is present, each msgpack record will create a separate request.
headers_key
Specify the key to use as the headers of the request (must prefix with "$"). The key must contain a map, which will have the contents merged on the request headers. This can be used for many purposes, such as specifying the content-type of the data contained in body_key.
Workers
Enables dedicated thread(s) for this output. Default value is set since version 1.8.13. For previous versions is 0.
2
HTTP output plugin supports TLS/SSL, for more details about the properties available and general configuration, please refer to the TLS/SSL section.
In order to insert records into a HTTP server, you can run the plugin from the command line or through the configuration file:
The http plugin, can read the parameters from the command line in two ways, through the -p argument (property) or setting them directly through the service URI. The URI format is the following:
Using the format specified, you could start Fluent Bit through:
In your main configuration file, append the following Input & Output sections:
By default, the URI becomes tag of the message, the original tag is ignored. To retain the tag, multiple configuration sections have to be made based and flush to different URIs.
Another approach we also support is the sending the original message tag in a configurable header. It's up to the receiver to do what it wants with that header field: parse it and use it as the tag for example.
To configure this behaviour, add this config:
Provided you are using Fluentd as data receiver, you can combine in_http
and out_rewrite_tag_filter
to make use of this HTTP header.
Notice how we override the tag, which is from URI path, with our custom header
Suggested configuration for Sumo Logic using json_lines
with iso8601
timestamps. The PrivateKey
is specific to a configured HTTP collector.
A sample Sumo Logic query for the CPU input. (Requires json_lines
format with iso8601
date format for the timestamp
field).
Setting
rdkafka.log.connection.close
tofalse
andrdkafka.request.required.acks
to 1 are examples of recommended settings of librdfkafka properties.
In order to insert records into Apache Kafka, you can run the plugin from the command line or through the configuration file:
The kafka plugin can read parameters through the -p argument (property), e.g:
In your main configuration file append the following Input & Output sections:
Fluent-bit comes with support for avro encoding for the out_kafka plugin. Avro support is optional and must be activated at build-time by using a build def with cmake: -DFLB_AVRO_ENCODER=On
such as in the following example which activates:
out_kafka with avro encoding
fluent-bit's prometheus
metrics via an embedded http endpoint
debugging support
builds the test suites
This is example fluent-bit config tails kubernetes logs, decorates the log lines with kubernetes metadata via the kubernetes filter, and then sends the fully decorated log lines to a kafka broker encoded with a specific avro schema.
In order to insert records into a Kafka REST Proxy service, you can run the plugin from the command line or through the configuration file:
The kafka-rest plugin, can read the parameters from the command line in two ways, through the -p argument (property), e.g:
In your main configuration file append the following Input & Output sections:
The Fluent Bit loki
built-in output plugin allows you to send your log or events to a Loki service. It supports data enrichment with Kubernetes labels, custom label keys and Tenant ID within others.
Loki store the record logs inside Streams, a stream is defined by a set of labels, at least one label is required.
Fluent Bit implements a flexible mechanism to set labels by using fixed key/value pairs of text but also allowing to set as labels certain keys that exists as part of the records that are being processed. Consider the following JSON record (pretty printed for readability):
If you decide that your Loki Stream will be composed by two labels called job
and the value of the record key called stream
, your labels
configuration properties might look as follows:
When processing above's configuration, internally the ending labels for the stream in question becomes:
Another feature of Labels management is the ability to provide custom key names, using the same record accessor pattern we can specify the key name manually and let the value to be populated automatically at runtime, e.g:
When processing that new configuration, the internal labels will be:
label_keys
propertyThe additional configuration property called label_keys
allow to specify multiple record keys that needs to be placed as part of the outgoing Stream Labels, yes, this is a similar feature than the one explained above in the labels
property. Consider this as another way to set a record key in the Stream, but with the limitation that you cannot use a custom name for the key value.
The following configuration examples generate the same Stream Labels:
the above configuration accomplish the same than this one:
both will generate the following Streams label:
label_map_path
propertyThe configuration property label_map_path
is to read a JSON file that defines how to extract labels from each record.
The file should contain a JSON object. Each keys define how to get label value from a nested record. Each values are used as label names.
The following configuration examples generate the same Stream Labels:
map.json:
The following configuration examples generate the same Stream Labels:
the above configuration accomplish the same than this one:
both will generate the following Streams label:
Note that if you are running in a Kubernetes environment, you might want to enable the option auto_kubernetes_labels
which will auto-populate the streams with the Pod labels for you. Consider the following configuration:
Based in the JSON example provided above, the internal stream labels will be:
This plugin inherit core Fluent Bit features to customize the network behavior and optionally enable TLS in the communication channel. For more details about the specific options available refer to the following articles:
Note that all options mentioned in the articles above must be enabled in the plugin configuration in question.
An example configuration - make sure to set the credentials and ensure the host URL matches the correct one for your deployment:
The following configuration example, will emit a dummy example record and ingest it on Loki . Copy and paste the following content into a file called out_loki.conf
:
run Fluent Bit with the new configuration file:
Fluent Bit output:
The log type to parse logs as. Google Chronicle supports parsing for .
Key to be used as the log level. Its value must be in (between 0 and 7). (Optional in GELF)
To visualize basic Logs Ingestion operation, see the following image:
Required - The client secret of the AAD application ().
Required - Data Collection Rule (DCR) immutable ID (see to collect the immutable id)
Specify an HTTP Proxy. The expected format of this value is http://HOST:PORT
. Note that HTTPS is not currently supported. It is recommended not to set this and to configure the instead as they support both HTTP and HTTPS.
Kafka output plugin allows to ingest your records into an service. This plugin use the official (built-in dependency)
The kafka-rest output plugin, allows to flush your records into a server. The following instructions assumes that you have a fully operational Kafka REST Proxy and Kafka services running in your environment.
Kafka REST Proxy output plugin supports TLS/SSL, for more details about the properties available and general configuration, please refer to the section.
is multi-tenant log aggregation system inspired by Prometheus. It is designed to be very cost effective and easy to operate.
Be aware there is a separate Golang output plugin provided by with different configuration options.
As you can see the label job
has the value fluentbit
and the second label is configured to access the nested map called sub
targeting the value of the key stream
. Note that the second label name must starts with a $
, that means that's a pattern so it provide you the ability to retrieve values from nested maps by using the key names.
: timeouts, keepalive and source address
: all about TLS configuration and certificates
Fluent Bit supports sending logs (and metrics) to by providing the appropriate URL and ensuring TLS is enabled.