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

Elasticsearch: Fix showing of logs when __source is log message field #80804

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

ivanahuckova
Copy link
Member

The Logs panel currently presents the first string data frame field as the log message. However, when the Elasticsearch response undergoes processing through the backend, we set the _source field to the type of *json.RawMessage which is on frontend represented as other. Consequently, it is skipped, and the subsequent field is displayed as the log message.

This PR addresses the problem by ensuring that for log queries, the __source is set as the string results, resolving the issue.

Fixed:
image
image

Current main:
image

Related to: #78790

To test:

  1. Run make devenv sources=elastic
  2. Create Elasticsearch data source and set log message field to __source
  3. Go to Explore and ensure that log message is from __source field

],
"testtime": "09/02/2023"
}
"{\"abc\":null,\"counter\":81,\"float\":10.911972180833306,\"is_true\":true,\"label\":\"val3\",\"line\":\"log text [106619125]\",\"location\":\"-42.73465234425797, -14.097854057104112\",\"lvl\":\"info\",\"nested_field.internal.nested\":\"value1\",\"shapes\":[{\"type\":\"triangle\"},{\"type\":\"triangle\"},{\"type\":\"triangle\"},{\"type\":\"square\"}],\"testtime\":\"09/02/2023\"}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand here is the _source change from json to string, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@ivanahuckova ivanahuckova merged commit 759c088 into main Jan 19, 2024
26 checks passed
@ivanahuckova ivanahuckova deleted the ivana/es-source-logs-panel branch January 19, 2024 09:28
grafana-delivery-bot bot pushed a commit that referenced this pull request Jan 19, 2024
…ld (#80804)

Elasticsearch: Fix showing of logs whe __source is log message field
(cherry picked from commit 759c088)
ivanahuckova added a commit that referenced this pull request Jan 19, 2024
…essage field (#80863)

Elasticsearch: Fix showing of logs when `__source` is log message field (#80804)

Elasticsearch: Fix showing of logs whe __source is log message field
(cherry picked from commit 759c088)

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
Ukochka pushed a commit that referenced this pull request Feb 14, 2024
…ld (#80804)

Elasticsearch: Fix showing of logs whe __source is log message field
@aangelisc aangelisc modified the milestones: 10.4.x, 10.4.0 Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants