Skip to content

Commit f3a6a2a

Browse files
authored
out_http: add examples for yaml configuration (#1308)
Signed-off-by: Takahiro Yamashita <[email protected]>
1 parent 39b2748 commit f3a6a2a

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

pipeline/outputs/http.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ $ fluent-bit -i cpu -t cpu -o http://192.168.2.3:80/something -m '*'
6161

6262
In your main configuration file, append the following _Input_ & _Output_ sections:
6363

64+
{% tabs %}
65+
{% tab title="fluent-bit.conf" %}
6466
```python
6567
[INPUT]
6668
Name cpu
@@ -73,13 +75,32 @@ In your main configuration file, append the following _Input_ & _Output_ section
7375
Port 80
7476
URI /something
7577
```
78+
{% endtab %}
79+
80+
{% tab title="fluent-bit.yaml" %}
81+
```yaml
82+
pipeline:
83+
inputs:
84+
- name: cpu
85+
tag: cpu
86+
outputs:
87+
- name: http
88+
match: '*'
89+
host: 192.168.2.3
90+
port: 80
91+
URI: /something
92+
```
93+
{% endtab %}
94+
{% endtabs %}
7695
7796
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.
7897
7998
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.
8099
81100
To configure this behaviour, add this config:
82101
102+
{% tabs %}
103+
{% tab title="fluent-bit.conf" %}
83104
```
84105
[OUTPUT]
85106
Name http
@@ -90,6 +111,22 @@ To configure this behaviour, add this config:
90111
Format json
91112
header_tag FLUENT-TAG
92113
```
114+
{% endtab %}
115+
116+
{% tab title="fluent-bit.yaml" %}
117+
```yaml
118+
outputs:
119+
- name: http
120+
match: '*'
121+
host: 192.168.2.3
122+
port: 80
123+
URI: /something
124+
format: json
125+
header_tag: FLUENT-TAG
126+
```
127+
{% endtab %}
128+
{% endtabs %}
129+
93130
94131
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.
95132

@@ -113,6 +150,8 @@ Notice how we override the tag, which is from URI path, with our custom header
113150
114151
#### Example : Add a header
115152
153+
{% tabs %}
154+
{% tab title="fluent-bit.conf" %}
116155
```
117156
[OUTPUT]
118157
Name http
@@ -123,11 +162,29 @@ Notice how we override the tag, which is from URI path, with our custom header
123162
Header X-Key-B Value_B
124163
URI /something
125164
```
165+
{% endtab %}
166+
167+
{% tab title="fluent-bit.yaml" %}
168+
```yaml
169+
outputs:
170+
- name: http
171+
match: '*'
172+
host: 127.0.0.1
173+
port: 9000
174+
header:
175+
- X-Key-A Value_A
176+
- X-Key-B Value_B
177+
URI: /something
178+
```
179+
{% endtab %}
180+
{% endtabs %}
126181

127182
#### Example : Sumo Logic HTTP Collector
128183

129184
Suggested configuration for Sumo Logic using `json_lines` with `iso8601` timestamps. The `PrivateKey` is specific to a configured HTTP collector.
130185

186+
{% tabs %}
187+
{% tab title="fluent-bit.conf" %}
131188
```
132189
[OUTPUT]
133190
Name http
@@ -139,6 +196,22 @@ Suggested configuration for Sumo Logic using `json_lines` with `iso8601` timesta
139196
Json_date_key timestamp
140197
Json_date_format iso8601
141198
```
199+
{% endtab %}
200+
201+
{% tab title="fluent-bit.yaml" %}
202+
```yaml
203+
outputs:
204+
- name: http
205+
match: '*'
206+
host: collectors.au.sumologic.com
207+
port: 443
208+
URI: /receiver/v1/http/[PrivateKey]
209+
format: json_lines
210+
json_date_key: timestamp
211+
json_date_format: iso8601
212+
```
213+
{% endtab %}
214+
{% endtabs %}
142215
143216
A sample Sumo Logic query for the [CPU](../inputs/cpu-metrics.md) input. \(Requires `json_lines` format with `iso8601` date format for the `timestamp` field\).
144217

0 commit comments

Comments
 (0)