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

About log.level JSON format resolve failed #8470

Closed
haoma2514 opened this issue Mar 13, 2025 · 6 comments
Closed

About log.level JSON format resolve failed #8470

haoma2514 opened this issue Mar 13, 2025 · 6 comments

Comments

@haoma2514
Copy link

Elastic.Clients.Elasticsearch version:8.17.1

Elasticsearch version:8.17.2

.NET runtime version:8.0

Operating system version:Windows 10 21H2

Description of the problem including expected versus actual behavior:
A clear and concise description of what the bug is.

Steps to reproduce:
1.

Image

Image

3.Log mapping to an object contains the Level attribute, but it becomes the "Log.Level" attribute after being obtained by the client.

Expected behavior
"level" is a property of the log object

@haoma2514 haoma2514 added 8.x Relates to 8.x client version Category: Bug labels Mar 13, 2025
@flobernd
Copy link
Member

Hi @haoma2514,

how do you ingest the logs?

The client does not modify the ingested documents/logs in any way. You always get exactly what's stored.

This means you have to address this issue on whatever place you use to ingest the logs.

@flobernd
Copy link
Member

flobernd commented Mar 13, 2025

FYI: The log.level and log: { level: ... } representation is equivalent for Elasticsearch given your current mapping. Processing, querying, etc. will work as expected.

The raw document however is not modified. If you need the property expanded in your .NET application, you have to make sure it's stored in the correct format in the first place (or you implement a custom JsonConverter for your log type and use that for deserialization).

@haoma2514
Copy link
Author

Hi @haoma2514

how do you ingest the logs?

The client does not modify the ingested documents/logs in any way. You always get exactly what's stored.

This means you have to address this issue on whatever place you use to ingest the logs.

Thank you for your reply. The log is written through Elastic.Extensions.Logging, for example: builder.logging.addelasticsearch (); I don't have a custom mapping relationship or an index template. Could it be Elastic.Extensions.Logging? In addition, I would like to ask, where can I quickly learn the client usage of V8 version?

@flobernd
Copy link
Member

Yes, in this case it seems to be the way how Elastic.Extensions.Logging ingests the logs. If you need to expand this dot-notation, you must write your own JsonConverter for the log type.

The official documentation for the client is here: https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/introduction.html. Improving it with more examples is something that's being worked on.

Please let me know, if you have more questions.

Copy link
Contributor

This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 2 days.

Copy link
Contributor

This issue was closed because it has been stalled for 2 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 23, 2025
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

2 participants