Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions pipeline/outputs/influxdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This plugin supports the following parameters:
| `Bucket` | InfluxDB bucket name where records will be inserted. If specified, `database` is ignored and v2 of API is used. | _none_ |
| `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` |
| `Strip_Prefix` | String prefix to be removed from the front of `tag` when writing InfluxDB measurement names. `Strip_Prefix` is removed only if it matches exactly at the beginning of and is strictly shorther than `tag` (`tag` length will not be reduced to zero if `Strip_Prefix` and `tag` are identical strings). `Strip_Prefix` defaults to empty string, which does nothing. | _none_ |
| `HTTP_User` | Optional username for HTTP Basic Authentication. | _none_ |
| `HTTP_Passwd` | Password for user defined in `HTTP_User`. | _none_ |
| `HTTP_Token` | Authentication token used with InfluxDB v2. If specified, both `HTTP_User` and `HTTP_Passwd` are ignored. | _none_ |
Expand Down Expand Up @@ -191,6 +192,81 @@ pipeline:
{% endtab %}
{% endtabs %}

### Prefix stripping

When collecting data from many inputs into many buckets, it can be helpful to remove a common prefix using `Strip_prefix`.

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
pipeline:
inputs:
- name: cpu
tag: cpu.one
- name: cpu
tag: cpu.two
- name: cpu
tag: gpu.one
- name: cpu
tag: gpu.two


outputs:
- name: influxdb
match: 'cpu*'
host: 127.0.0.1
port: 8086
bucket: cpubucket
strip_prefix: cpu.
- name: influxdb
match: 'gpu*'
host: 127.0.0.1
port: 8086
bucket: gpubucket
strip_prefix: gpu.
```

{% endtab %}
{% tab title="fluent-bit.conf" %}

```text
[INPUT]
Name cpu
Tag cpu.one

[INPUT]
Name cpu
Tag cpu.two

[INPUT]
Name cpu
Tag gpu.one

[INPUT]
Name cpu
Tag gpu.two

[OUTPUT]
Name influxdb
Match cpu*
Bucket cpubucket
Strip_prefix cpu.

[OUTPUT]
Name influxdb
Match gpu*
Bucket gpubucket
Strip_prefix gpu.
```

{% endtab %}
{% endtabs %}


This will result in the buckets `cpubucket` and `gpubucket` each containing two measurement streams named `one` and `two`. Without prefix stripping, the measurement names would be `cpu.one` and `cpu.two` (stored in `cpubucket`), and `gpu.one`, `gpu.two` (stored in `gpubucket`).


### Testing

Before starting Fluent Bit, ensure the target database exists on InfluxDB. Using the previous example, insert the data into a `fluentbit` database.
Expand Down