# HTTP

## Configuration Parameters

| **Key**                    | Description                                                                                                                                     | default |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| listen                     | The address to listen on                                                                                                                        | 0.0.0.0 |
| port                       | The port for Fluent Bit to listen on                                                                                                            | 9880    |
| tag\_key                   | Specify the key name to overwrite a tag. If set, the tag will be overwritten by a value of the key.                                             |         |
| buffer\_max\_size          | Specify the maximum buffer size in KB to receive a JSON message.                                                                                | 4M      |
| buffer\_chunk\_size        | This sets the chunk size for incoming incoming JSON messages. These chunks are then stored/managed in the space available by buffer\_max\_size. | 512K    |
| successful\_response\_code | It allows to set successful response code. `200`, `201` and `204` are supported.                                                                | 201     |
| success\_header            | Add an HTTP header key/value pair on success. Multiple headers can be set. Example: `X-Custom custom-answer`                                    |         |

### TLS / SSL

HTTP input plugin supports TTL/SSL, for more details about the properties available and general configuration, please refer to the [Transport Security](/manual/2.1/administration/transport-security.md) section.

## Getting Started

The http input plugin allows Fluent Bit to open up an HTTP port that you can then route data to in a dynamic way. This plugin supports dynamic tags which allow you to send data with different tags through the same input. An example video and curl message can be seen below

[Link to video](https://asciinema.org/a/375571)

#### How to set tag

The tag for the HTTP input plugin is set by adding the tag to the end of the request URL. This tag is then used to route the event through the system. For example, in the following curl message below the tag set is `app.log**. **` because the end end path is `/app_log`:

### Curl request

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

### Configuration File

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

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

If you do not 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.

### Curl request

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

### Configuration File

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

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

#### How to set tag\_key

The tag\_key configuration option allows to specify the key name that will be used to overwrite a tag. The tag's value will be replaced with the value associated with the specified key. For example, setting tag\_key to "custom\_tag" and the log event contains a json field with the key "custom\_tag" Fluent Bit will use the value of that field as the new tag for routing the event through the system.

### Curl request

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

### Configuration File

```
[INPUT]
    name http
    listen 0.0.0.0
    port 8888
    tag_key key1

[OUTPUT]
    name stdout
    match value1
```

#### How to set multiple custom HTTP header on success

The `success_header` parameter allows to set multiple HTTP headers on success. The format is:

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

#### Example Curl message

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

### Configuration File

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

[OUTPUT]
    name stdout
    match *
```

### Command Line

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fluentbit.io/manual/2.1/pipeline/inputs/http.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
