Skip to content

out_http: add examples for yaml configuration #1308

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

Merged
merged 1 commit into from
Feb 21, 2024
Merged
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
73 changes: 73 additions & 0 deletions pipeline/outputs/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ $ fluent-bit -i cpu -t cpu -o http://192.168.2.3:80/something -m '*'

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

{% tabs %}
{% tab title="fluent-bit.conf" %}
```python
[INPUT]
Name cpu
Expand All @@ -73,13 +75,32 @@ In your main configuration file, append the following _Input_ & _Output_ section
Port 80
URI /something
```
{% endtab %}

{% tab title="fluent-bit.yaml" %}
```yaml
pipeline:
inputs:
- name: cpu
tag: cpu
outputs:
- name: http
match: '*'
host: 192.168.2.3
port: 80
URI: /something
```
{% endtab %}
{% endtabs %}

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.

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.

To configure this behaviour, add this config:

{% tabs %}
{% tab title="fluent-bit.conf" %}
```
[OUTPUT]
Name http
Expand All @@ -90,6 +111,22 @@ To configure this behaviour, add this config:
Format json
header_tag FLUENT-TAG
```
{% endtab %}

{% tab title="fluent-bit.yaml" %}
```yaml
outputs:
- name: http
match: '*'
host: 192.168.2.3
port: 80
URI: /something
format: json
header_tag: FLUENT-TAG
```
{% endtab %}
{% endtabs %}


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.

Expand All @@ -113,6 +150,8 @@ Notice how we override the tag, which is from URI path, with our custom header

#### Example : Add a header

{% tabs %}
{% tab title="fluent-bit.conf" %}
```
[OUTPUT]
Name http
Expand All @@ -123,11 +162,29 @@ Notice how we override the tag, which is from URI path, with our custom header
Header X-Key-B Value_B
URI /something
```
{% endtab %}

{% tab title="fluent-bit.yaml" %}
```yaml
outputs:
- name: http
match: '*'
host: 127.0.0.1
port: 9000
header:
- X-Key-A Value_A
- X-Key-B Value_B
URI: /something
```
{% endtab %}
{% endtabs %}

#### Example : Sumo Logic HTTP Collector

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

{% tabs %}
{% tab title="fluent-bit.conf" %}
```
[OUTPUT]
Name http
Expand All @@ -139,6 +196,22 @@ Suggested configuration for Sumo Logic using `json_lines` with `iso8601` timesta
Json_date_key timestamp
Json_date_format iso8601
```
{% endtab %}

{% tab title="fluent-bit.yaml" %}
```yaml
outputs:
- name: http
match: '*'
host: collectors.au.sumologic.com
port: 443
URI: /receiver/v1/http/[PrivateKey]
format: json_lines
json_date_key: timestamp
json_date_format: iso8601
```
{% endtab %}
{% endtabs %}

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\).

Expand Down