http
Last updated
Last updated
The in_http
Input plugin enables Fluentd to retrieve records from HTTP POST. The URL path becomes the tag
of the Fluentd event log and the POSTed body element becomes the record itself.
in_http
is included in Fluentd's core. No additional installation process is required.
Please see the Config File article for the basic structure and syntax of the configuration file.
The example below posts a record using the curl
command.
The value must be http
.
The port to listen to. Default Value = 9880
The bind address to listen to. Default Value = 0.0.0.0 (all addresses)
The size limit of the POSTed element. Default Value = 32MB
The timeout limit for keeping the connection alive. Default Value = 10 seconds
Add HTTP_
prefix headers to the record. The default is false
Add REMOTE_ADDR
field to the record. The value of REMOTE_ADDR
is the client's address. The default is false
If your system set multiple X-Forwarded-For
headers in the request, in_http
uses first one. For example:
If send above multiple headers, REMOTE_ADDR
value is host1
.
White list domains for CORS. Default is no check.
If you set ["domain1", "domain2"]
to cors_allow_origins
, in_http
returns 403
to access from othe domains.
The format of the HTTP body. The default is default
.
default
Accept records using json=
/ msgpack=
style.
regexp
Specify body format by regular expression.
If you execute following command:
then got parsed result like below:
json
, ltsv
, tsv
, csv
and none
are also supported. Check parser plugin overview for more details.
The log_level
option allows the user to set different levels of logging for each plugin. The supported log levels are: fatal
, error
, warn
, info
, debug
, and trace
.
Please see the logging article for further details.
If you want to pass the event time from your application, please use the time
query parameter.
If you use default
format, then you can send array type of json / msgpack to in_http.
This improves the input performance by reducing HTTP access. Non default
format doesn't support batch mode yet. Here is a simple bechmark result on MacBook Pro with ruby 2.3:
json
msgpack
msgpack array(10 items)
2100 events/sec
2400 events/sec
10000 events/sec
Tested configuration and ruby script is here.
This is HTTP spec, not fluentd problem. You need to encode your payload properly or use multipart request. Here is ruby example:
curl command example:
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is a open source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.