From cd45857243db58189acdc4541b1e05052e871df5 Mon Sep 17 00:00:00 2001 From: Ueli Graf Date: Tue, 1 Oct 2024 09:42:41 +0200 Subject: [PATCH 1/2] out_influxdb: add documentation and example use of strip_prefix Signed-off-by: Ueli Graf --- pipeline/outputs/influxdb.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/pipeline/outputs/influxdb.md b/pipeline/outputs/influxdb.md index 2b59703f4..9854318fa 100644 --- a/pipeline/outputs/influxdb.md +++ b/pipeline/outputs/influxdb.md @@ -12,6 +12,7 @@ The **influxdb** output plugin, allows to flush your records into a [InfluxDB](h | 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 | +| Strip\_Prefix | String to be stripped from the front of _tag_ when writing influxdb measurement names | | | 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 | | @@ -109,6 +110,40 @@ Basic example of `Tags_List_Key` usage: Tag_Keys level status ``` +### Prefix stripping + +When collecting data from many inputs into many buckets, it can be helpful to remove a common prefix using _Strip_prefix_. + +```python +[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. +``` + ### Testing 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. From 4bff80f43b4049062a2a506989bbf72446154f28 Mon Sep 17 00:00:00 2001 From: Ueli Graf Date: Tue, 1 Oct 2024 09:54:28 +0200 Subject: [PATCH 2/2] Add comment about bucket versus measurement naming Signed-off-by: Ueli Graf --- pipeline/outputs/influxdb.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pipeline/outputs/influxdb.md b/pipeline/outputs/influxdb.md index 9854318fa..24171c018 100644 --- a/pipeline/outputs/influxdb.md +++ b/pipeline/outputs/influxdb.md @@ -144,6 +144,8 @@ When collecting data from many inputs into many buckets, it can be helpful to re Strip_prefix gpu. ``` +This will result in the buckets _cpubucket_, _gpubucket_ each containing two measurement streams named _one_, _two_. Without prefix stripping, the measurement names would be _cpu.one_, _cpu.two_ (stored in _cpubucket_) and _gpu.one_, _gpu.two_ (stored in _gpubucket_). + ### Testing 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.