Skip to content

http_in returns internal server error if a field "time" is provided as a string #3036

@dobesv

Description

@dobesv

Describe the bug

When submitting logs to the http input, if the logs contain a time field that isn't a floating point seconds since the epoch, a status 500 is returned. I think it should return a status 400 instead, if the data is not valid.

Further, there's nothing mentioned in the documentation that the field time inside a log record has any special significance or constraint upon it. time is only documented as a query parameter.

To Reproduce

Just for example:

curl 'https://fluentd-hostname/web' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'accept: */*' \
  -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
  --data-raw 'json=%5B%7B%22anonymousId%22%3A%225eb1b213517fe50000ea9b52%22%2C%22name%22%3A%22formative%22%2C%22level%22%3A40%2C%22levelName%22%3A%22warn%22%2C%22msg%22%3A%22test%22%2C%22time%22%3A%222020-06-10T17%3A30%3A29.802Z%22%2C%22timestamp%22%3A%222020-06-10T17%3A30%3A29.804Z%22%7D%5D'

This causes an internal server error parsing the "time" field. The error message is returned to the client with status 500 "internal server error".

Furthermore, observe that the documentation does not mention the special nature of the time field in a log record.

Expected behavior

A status 400 should be returned to indicate it was supposedly the client that made the mistake.

Additionally, the documentation should describe the usage and restrictions of the time field of log records submitted to the http input.

Your Environment

fluentd (1.11.0) running in kubernetes using the docker debian image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions