Skip to content

Java Json format not consistent with ECS #102

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

Closed
olwulff opened this issue Nov 3, 2020 · 4 comments
Closed

Java Json format not consistent with ECS #102

olwulff opened this issue Nov 3, 2020 · 4 comments

Comments

@olwulff
Copy link

olwulff commented Nov 3, 2020

I've imported the ecs template into our cluster and ingested data using ecs-logging-java and ecs-logging-python. The latter formats json log statements which match the ecs structure but Java not.

Here a snippet:
...
"log.level":"DEBUG",
...
"log.origin": {
"file.line": 655,
"file.name": "SpringApplication.java",
"function": "logStartupProfileInfo"
},

This should look like:
...
"log": {
"level": "DEBUG",
"origin": {
"file": {
"line": 655,
"name": "SpringApplication.java""
},
"function": "logStartupProfileInfo"
},
...

@felixbarny
Copy link
Member

Closing as duplicate of #51

Please let me know whether the dot_expander Filebeat processor would work in your case: elastic/beats#17021

@olwulff
Copy link
Author

olwulff commented Nov 13, 2020

We fix it within logstash at the moment.

@Fr33Radical
Copy link

Fr33Radical commented Aug 29, 2021

Hello,
If we create a ECS java object from yaml ecs file as mentioned in https://github.com/elastic/ecs-logging-java/issues/38 therefore since the client use a typed object hierarchy, there would no longer need to relate on the dot to create the JSON structure.

Could that resolve the issue of https://github.com/elastic/ecs-logging-java/issues/51?

Closing this as it's not feasible to guarantee all fields are nested, especially when allowing user-defined custom attributes.

The typed object hierarchy could standardize the way of organizing the JSON.

Hence, would that not simplify the problem and make the solution possible in the java-ecs-library?

@felixbarny
Copy link
Member

While a typed object structure is a great way to add additional fields, it does come with an overhead for the simple case where you just log a message.
Nesting all fields would also make the JSON less human-readable. It purposefully starts with the fields @timestamp, log.level, and message. If we were to nest all fields, the log.level field would be part of the log object that contains log.logger, and other fields.

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

No branches or pull requests

3 participants