Skip to content
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

[LogstashFormatter] ECS support #1771

Open
rneuter opened this issue Nov 1, 2022 · 3 comments
Open

[LogstashFormatter] ECS support #1771

rneuter opened this issue Nov 1, 2022 · 3 comments

Comments

@rneuter
Copy link

rneuter commented Nov 1, 2022

👋

I was wondering if Elastic Common Schema will be supported in the future.

For example, in the ECS, the host field should be an object but is set as a scalar string in the LogstashFormatter.

Since version 8 of the ELK stack, ECS is enabled by default on a new installation causing ingestion errors:

Log sent to Logstash from a classic Symfony / Monolog:

{
    "@timestamp": "2022-11-01T15:12:00.252242+00:00",
    "@version": 1,
    "host": "7f50b1b63228",
    "message": "Authenticator successful!",
    "type": "app",
    "channel": "security",
    "level": "INFO",
    "monolog_level": 200,
    "context": {
        "token": {
            "Lexik\\Bundle\\JWTAuthenticationBundle\\Security\\Authenticator\\Token\\JWTPostAuthenticationToken": "JWTPostAuthenticationToken(user=\"x.com\", authenticated=true, roles=\"ROLE_USER\")"
        },
        "authenticator": "Lexik\\Bundle\\JWTAuthenticationBundle\\Security\\Authenticator\\JWTAuthenticator"
    }
}

Logstash response:

{
    "error": {
        "type": "mapper_parsing_exception",
        "reason": "object mapping for [host] tried to parse field [host] as object, but found a concrete value"
    }
}

Support of ECS will bring breaking changes but definitely avoid extra setup time on new installations, which should increase time after time.

I'm not sure of how many fields are concerned but from what I see maybe it's only the host field.

Let me know if you are interested about feedback or to discuss on this!

@rneuter rneuter added the Feature label Nov 1, 2022
@Seldaek
Copy link
Owner

Seldaek commented Feb 4, 2023

I guess this could be a configurable flag on LogstashFormatter so one can enable ECS support, and maybe a deprecation warning if not enabled so people are nudged to migrate slowly and in monolog 4 we can enable by default?

@Seldaek
Copy link
Owner

Seldaek commented Feb 4, 2023

In any case PR welcome, I don't have access to an ECS stack so rather have someone knowledgeable do this.

@vivere-dally
Copy link

I think renaming to hostname instead of host would be sufficent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants