-
Notifications
You must be signed in to change notification settings - Fork 552
out_influxdb: documentation for tag prefix stripping #1468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ueli-g
wants to merge
8
commits into
fluent:master
Choose a base branch
from
ueli-g:influxdb-strip-tag-prefix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+80
−0
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cd45857
out_influxdb: add documentation and example use of strip_prefix
4bff80f
Add comment about bucket versus measurement naming
a391c5e
Merge branch 'master' into influxdb-strip-tag-prefix
esmerel ce52150
Apply suggestions from code review
esmerel f8865b4
Add yaml config example, clarify behaviour of config option
acf18a3
Merge branch 'master' into influxdb-strip-tag-prefix
151186b
Added Host and Port config
36a6fbb
Remove default behaviour note
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| | `org` | InfluxDB organization name where the bucket is (v2 only). | `fluent` | | ||
| | `port` | TCP port of the target InfluxDB service. | `8086` | | ||
| | `sequence_tag` | The name of the tag whose value is incremented for consecutive simultaneous events. | _none_ | | ||
| | `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 shorter than `tag` (`tag` length will not be reduced to zero if `strip_prefix` and `tag` are identical strings). | _none_ | | ||
|
Check warning on line 25 in pipeline/outputs/influxdb.md
|
||
| | `tag_keys` | Space-separated list of keys to tag. | _none_ | | ||
| | `uri` | Custom URI endpoint. | _none_ | | ||
| | `workers` | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `0` | | ||
|
|
@@ -143,6 +144,85 @@ | |
| `Auto_Tags=On` in this example causes an error, because every parsed field value type is `string`. The best usage of this option in metrics like record where one or more field value isn't `string` typed. | ||
|
|
||
|
|
||
| ### Prefix stripping | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ueli-g please format all yaml and classic config example code with 2 spaced indents (currently using 4?). |
||
|
|
||
| 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 | ||
| Host 127.0.0.1 | ||
| Port 8086 | ||
| Match cpu* | ||
| Bucket cpubucket | ||
| Strip_prefix cpu. | ||
|
|
||
| [OUTPUT] | ||
| Name influxdb | ||
| Host 127.0.0.1 | ||
| Port 8086 | ||
| Match gpu* | ||
| Bucket gpubucket | ||
| Strip_prefix gpu. | ||
| ``` | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| {% 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. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ueli-g small fix here needed for vale check.