Skip to content
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
150 changes: 75 additions & 75 deletions pipeline/inputs/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,12 @@ The tag for the HTTP input plugin is set by adding the tag to the end of the req
For example, in the following curl message the tag set is `app.log**. **` because the end path is `/app_log`:

```shell
curl -d '{"key1":"value1","key2":"value2"}' -XPOST -H "content-type: application/json" http://localhost:8888/app.log
$ curl -d '{"key1":"value1","key2":"value2"}' -XPOST -H "content-type: application/json" http://localhost:8888/app.log
```

### Configuration file

{% tabs %}
{% tab title="fluent-bit.conf" %}

```python
[INPUT]
name http
listen 0.0.0.0
port 8888

[OUTPUT]
name stdout
match app.log
```

{% endtab %}

{% tab title="fluent-bit.yaml" %}

```yaml
Expand All @@ -66,38 +51,38 @@ pipeline:
- name: http
listen: 0.0.0.0
port: 8888

outputs:
- name: stdout
match: app.log
```

{% endtab %}
{% endtabs %}

### Configuration file `http.0` example

If you don't set the tag, `http.0` is automatically used. If you have multiple HTTP inputs then they will follow a pattern of `http.N` where `N` is an integer representing the input.

```shell
curl -d '{"key1":"value1","key2":"value2"}' -XPOST -H "content-type: application/json" http://localhost:8888
```

{% tabs %}
{% tab title="fluent-bit.conf" %}

```python
```text
[INPUT]
name http
listen 0.0.0.0
port 8888

[OUTPUT]
name stdout
match http.0
name stdout
match app.log
```

{% endtab %}
{% endtabs %}

### Configuration file `http.0` example

If you don't set the tag, `http.0` is automatically used. If you have multiple HTTP inputs then they will follow a pattern of `http.N` where `N` is an integer representing the input.

```shell
$ curl -d '{"key1":"value1","key2":"value2"}' -XPOST -H "content-type: application/json" http://localhost:8888
```

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
Expand All @@ -106,11 +91,26 @@ pipeline:
- name: http
listen: 0.0.0.0
port: 8888

outputs:
- name: stdout
match: http.0
```

{% endtab %}
{% tab title="fluent-bit.conf" %}

```text
[INPUT]
name http
listen 0.0.0.0
port 8888

[OUTPUT]
name stdout
match http.0
```

{% endtab %}
{% endtabs %}

Expand All @@ -121,15 +121,31 @@ The `tag_key` configuration option lets you specify the key name that will be us
### Curl request

```shell
curl -d '{"key1":"value1","key2":"value2"}' -XPOST -H "content-type: application/json" http://localhost:8888/app.log
$ curl -d '{"key1":"value1","key2":"value2"}' -XPOST -H "content-type: application/json" http://localhost:8888/app.log
```

### Configuration file `tag_key` example

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
pipeline:
inputs:
- name: http
listen: 0.0.0.0
port: 8888
tag_key: key1

outputs:
- name: stdout
match: value1
```

{% endtab %}
{% tab title="fluent-bit.conf" %}

```python
```text
[INPUT]
name http
listen 0.0.0.0
Expand All @@ -142,76 +158,46 @@ curl -d '{"key1":"value1","key2":"value2"}' -XPOST -H "content-type: application
```

{% endtab %}
{% endtabs %}

#### Set multiple custom HTTP headers on success

The `success_header` parameter lets you set multiple HTTP headers on success. The format is:

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
pipeline:
inputs:
- name: http
listen: 0.0.0.0
port: 8888
tag_key: key1
outputs:
- name: stdout
match: value1
success_header:
- X-Custom custom-answer
- X-Another another-answer
```

{% endtab %}
{% endtabs %}

#### Set multiple custom HTTP headers on success

The `success_header` parameter lets you set multiple HTTP headers on success. The format is:

{% tabs %}
{% tab title="fluent-bit.conf" %}

```python
```text
[INPUT]
name http
success_header X-Custom custom-answer
success_header X-Another another-answer
```

{% endtab %}

{% tab title="fluent-bit.yaml" %}

```yaml
inputs:
- name: http
success_header: X-Custom custom-answer
success_header: X-Another another-answer
```

{% endtab %}
{% endtabs %}

#### Example curl message

```shell
curl -d @app.log -XPOST -H "content-type: application/json" http://localhost:8888/app.log
$ curl -d @app.log -XPOST -H "content-type: application/json" http://localhost:8888/app.log
```

### Configuration file example 3

{% tabs %}
{% tab title="fluent-bit.conf" %}

```python
[INPUT]
name http
listen 0.0.0.0
port 8888

[OUTPUT]
name stdout
match *
```

{% endtab %}

{% tab title="fluent-bit.yaml" %}

```yaml
Expand All @@ -226,11 +212,25 @@ pipeline:
match: '*'
```

{% endtab %}
{% tab title="fluent-bit.conf" %}

```text
[INPUT]
name http
listen 0.0.0.0
port 8888

[OUTPUT]
name stdout
match *
```

{% endtab %}
{% endtabs %}

### Command line

```shell
fluent-bit -i http -p port=8888 -o stdout
```
$ fluent-bit -i http -p port=8888 -o stdout
```