Skip to content

Commit 8e78469

Browse files
authored
Merge pull request #1945 from fluent/lynettemiles/sc-136244/update-fluent-bit-docs-pipeline-outputs-influxdb
2 parents 9e241a5 + 3088be6 commit 8e78469

File tree

1 file changed

+105
-103
lines changed

1 file changed

+105
-103
lines changed

pipeline/outputs/influxdb.md

Lines changed: 105 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,53 @@
11
# InfluxDB
22

3-
The **influxdb** output plugin, allows to flush your records into a [InfluxDB](https://www.influxdata.com/time-series-platform/influxdb/) time series database. The following instructions assumes that you have a fully operational InfluxDB service running in your system.
3+
The _InfluxDB_ output plugin lets you flush your records into a [InfluxDB](https://www.influxdata.com/time-series-platform/influxdb/) time series database. The following instructions assume that you have an operational InfluxDB service running in your system.
44

5-
## Configuration Parameters
5+
## Configuration parameters
66

7-
| Key | Description | default |
7+
This plugin supports the following parameters:
8+
9+
| Key | Description | Default |
810
| :--- | :--- | :--- |
9-
| Host | IP address or hostname of the target InfluxDB service | 127.0.0.1 |
10-
| Port | TCP port of the target InfluxDB service | 8086 |
11-
| Database | InfluxDB database name where records will be inserted | fluentbit |
12-
| Bucket | InfluxDB bucket name where records will be inserted - if specified, `database` is ignored and v2 of API is used | |
13-
| Org | InfluxDB organization name where the bucket is \(v2 only\) | fluent |
14-
| Sequence\_Tag | The name of the tag whose value is incremented for the consecutive simultaneous events. | \_seq |
15-
| HTTP\_User | Optional username for HTTP Basic Authentication | |
16-
| HTTP\_Passwd | Password for user defined in HTTP\_User | |
17-
| HTTP\_Token | Authentication token used with InfluDB v2 - if specified, both HTTP\_User and HTTP\_Passwd are ignored | |
18-
| HTTP\_Header | Add a HTTP header key/value pair. Multiple headers can be set | |
19-
| Tag\_Keys | Space separated list of keys that needs to be tagged | |
20-
| Auto\_Tags | Automatically tag keys where value is _string_. This option takes a boolean value: True/False, On/Off. | Off |
21-
| Uri | Custom URI endpoint | |
22-
| Add\_Integer\_Suffix | Use integer type of [influxdb's line protocol](https://docs.influxdata.com/influxdb/v1/write_protocols/line_protocol_reference/). This option takes a boolean value: `True|False`, `On|Off`. | `Off` |
23-
| Workers | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `0` |
11+
| `Host` | IP address or hostname of the target InfluxDB service. | `127.0.0.1` |
12+
| `Port` | TCP port of the target InfluxDB service. | `8086` |
13+
| `Database` | InfluxDB database name where records will be inserted. | `fluentbit` |
14+
| `Bucket` | InfluxDB bucket name where records will be inserted. If specified, `database` is ignored and v2 of API is used. | _none_ |
15+
| `Org` | InfluxDB organization name where the bucket is (v2 only). | `fluent` |
16+
| `Sequence_Tag` | The name of the tag whose value is incremented for the consecutive simultaneous events. | `_seq` |
17+
| `HTTP_User` | Optional username for HTTP Basic Authentication. | _none_ |
18+
| `HTTP_Passwd` | Password for user defined in `HTTP_User`. | _none_ |
19+
| `HTTP_Token` | Authentication token used with InfluxDB v2. If specified, both `HTTP_User` and `HTTP_Passwd` are ignored. | _none_ |
20+
| `HTTP_Header` | Add a HTTP header key/value pair. Multiple headers can be set. | _none_ |
21+
| `Tag_Keys` | Space separated list of keys that needs to be tagged. | _none_ |
22+
| `Auto_Tags` | Automatically tag keys where value is `string`. This option takes a Boolean value: `True`/`False`, `On`/`Off`. | `Off` |
23+
| `Uri` | Custom URI endpoint. | _none_ |
24+
| `Add_Integer_Suffix` | Use integer type of [InfluxDB's line protocol](https://docs.influxdata.com/influxdb/v1/write_protocols/line_protocol_reference/). This option takes a Boolean value: `True`/`False`, `On`/`Off`. | `Off` |
25+
| `Workers` | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `0` |
2426

2527
### TLS / SSL
2628

2729
The InfluxDB output plugin supports TLS/SSL.
2830
For more details about the properties available and general configuration, see [TLS/SSL](../../administration/transport-security.md).
2931

30-
## Getting Started
32+
## Get started
3133

32-
In order to start inserting records into an InfluxDB service, you can run the plugin from the command line or through the configuration file:
34+
To start inserting records into an InfluxDB service, you can run the plugin from the command line or through the configuration file.
3335

34-
### Command Line
36+
### Command line
3537

36-
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:
38+
The InfluxDB plugin can read the parameters from the command line through the `-p` argument (property) or by setting them directly through the service URI. The URI format is the following:
3739

3840
```text
3941
influxdb://host:port
4042
```
4143

42-
Using the format specified, you could start Fluent Bit through:
44+
Using the format specified, you could start Fluent Bit:
4345

4446
```shell
4547
fluent-bit -i cpu -t cpu -o influxdb://127.0.0.1:8086 -m '*'
4648
```
4749

48-
### Configuration File
50+
### Configuration file
4951

5052
In your main configuration file append the following:
5153

@@ -57,7 +59,7 @@ pipeline:
5759
inputs:
5860
- name: cpu
5961
tag: cpu
60-
62+
6163
outputs:
6264
- name: influxdb
6365
match: '*'
@@ -101,7 +103,7 @@ pipeline:
101103
tag: apache.access
102104
parser: apache2
103105
path: /var/log/apache2/access.log
104-
106+
105107
outputs:
106108
- name: influxdb
107109
match: '*'
@@ -137,9 +139,9 @@ pipeline:
137139
{% endtab %}
138140
{% endtabs %}
139141

140-
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.
142+
`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.
141143

142-
Basic example of `Tags_List_Key` usage:
144+
A basic example of `Tags_List_Key` usage:
143145

144146
{% tabs %}
145147
{% tab title="fluent-bit.yaml" %}
@@ -150,7 +152,7 @@ pipeline:
150152
- name: dummy
151153
# tagged fields: level, ID, businessObjectID, status
152154
dummy: '{"msg": "Transfer completed", "level": "info", "ID": "1234", "businessObjectID": "qwerty", "status": "OK", "tags": ["ID", "businessObjectID"]}'
153-
155+
154156
outputs:
155157
- name: influxdb
156158
match: '*'
@@ -192,101 +194,101 @@ pipeline:
192194

193195
### Testing
194196

195-
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.
197+
Before starting Fluent Bit, ensure the target database exists on InfluxDB. Using the previous example, insert the data into a `fluentbit` database.
196198

197-
#### 1. Create database
199+
1. Log into the InfluxDB console:
198200

199-
Log into InfluxDB console:
201+
```shell
202+
influx
203+
```
200204

201-
```shell
202-
$ influx
205+
Which should return a result like:
203206

204-
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.
205-
Connected to http://localhost:8086 version 1.1.0
206-
InfluxDB shell version: 1.1.0
207-
>
208-
```
207+
```text
208+
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.
209+
Connected to http://localhost:8086 version 1.1.0
210+
InfluxDB shell version: 1.1.0
211+
>
212+
```
209213

210-
Create the database:
214+
1. Create the database:
211215

212-
```text
213-
> create database fluentbit
214-
>
215-
```
216+
```text
217+
> create database fluentbit
218+
>
219+
```
216220

217-
Check the database exists:
221+
1. Check that the database exists:
218222

219-
```text
220-
> show databases
221-
name: databases
222-
name
223-
----
224-
_internal
225-
fluentbit
226-
227-
>
228-
```
223+
```text
224+
> show databases
225+
name: databases
226+
name
227+
----
228+
_internal
229+
fluentbit
229230
230-
#### 2. Run Fluent Bit
231+
>
232+
```
231233

232-
The following command will gather CPU metrics from the system and send the data to InfluxDB database every five seconds:
234+
1. Run Fluent Bit:
233235

234-
```shell
235-
fluent-bit -i cpu -t cpu -o influxdb -m '*'
236-
```
236+
The following command will gather CPU metrics from the system and send the data to InfluxDB database every five seconds:
237237

238-
Note that all records coming from the _cpu_ input plugin, have a tag _cpu_, this tag is used to generate the measurement in InfluxDB
238+
```shell
239+
fluent-bit -i cpu -t cpu -o influxdb -m '*'
240+
```
239241

240-
#### 3. Query the data
242+
All records coming from the `cpu` input plugin have a tag `cpu`. This tag is used to generate the measurement in InfluxDB.
241243

242-
From InfluxDB console, choose your database:
244+
1. Query the data:
243245

244-
```text
245-
> use fluentbit
246-
Using database fluentbit
247-
```
246+
From InfluxDB console, choose your database:
248247

249-
Now query some specific fields:
248+
```text
249+
> use fluentbit
250+
Using database fluentbit
251+
```
250252

251-
```text
252-
> SELECT cpu_p, system_p, user_p FROM cpu
253-
name: cpu
254-
time cpu_p system_p user_p
255-
---- ----- -------- ------
256-
1481132860000000000 2.75 0.5 2.25
257-
1481132861000000000 2 0.5 1.5
258-
1481132862000000000 4.75 1.5 3.25
259-
1481132863000000000 6.75 1.25 5.5
260-
1481132864000000000 11.25 3.75 7.5
261-
```
253+
1. Query some specific fields:
262254

263-
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:
255+
```text
256+
> SELECT cpu_p, system_p, user_p FROM cpu
257+
name: cpu
258+
time cpu_p system_p user_p
259+
---- ----- -------- ------
260+
1481132860000000000 2.75 0.5 2.25
261+
1481132861000000000 2 0.5 1.5
262+
1481132862000000000 4.75 1.5 3.25
263+
1481132863000000000 6.75 1.25 5.5
264+
1481132864000000000 11.25 3.75 7.5
265+
```
264266

265-
```text
266-
> SELECT * FROM cpu
267-
```
267+
The CPU input plugin gathers more metrics per CPU core. This example selected three specific metrics. The following query will give a full result:
268268

269-
#### 4. View tags
269+
```text
270+
> SELECT * FROM cpu
271+
```
270272

271-
Query tagged keys:
273+
1. View tags by querying tagged keys:
272274

273-
```text
274-
> SHOW TAG KEYS ON fluentbit FROM "apache.access"
275-
name: apache.access
276-
tagKey
277-
------
278-
_seq
279-
method
280-
path
281-
```
275+
```text
276+
> SHOW TAG KEYS ON fluentbit FROM "apache.access"
277+
name: apache.access
278+
tagKey
279+
------
280+
_seq
281+
method
282+
path
283+
```
282284

283-
And now query _method_ key values:
285+
1. Query `method` key values:
284286

285-
```text
286-
> SHOW TAG VALUES ON fluentbit FROM "apache.access" WITH KEY = "method"
287-
name: apache.access
288-
key value
289-
--- -----
290-
method "MATCH"
291-
method "POST"
292-
```
287+
```text
288+
> SHOW TAG VALUES ON fluentbit FROM "apache.access" WITH KEY = "method"
289+
name: apache.access
290+
key value
291+
--- -----
292+
method "MATCH"
293+
method "POST"
294+
```

0 commit comments

Comments
 (0)