-
Notifications
You must be signed in to change notification settings - Fork 75
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
Log Context #992
Log Context #992
Conversation
Do we enforce the right order for filter fields?
We'll need to extend the guide to recommend the field aliasing feature |
Brilliant! 👍 |
I don't think they need a specific order, the query analyzer should handle that right?
Using |
b4d0537
to
18b3c8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, just one nit in the comments. I believe it'd be worthwhile updating the documentation to include some of the information you've specified in the PR description as it's extremely beneficial.
Still suspicious of the yarn lockfile, but that last type is fixed |
Overview
This PR implements Log Context for logs queries.
Implementation
This feature works by taking a logs query and removing all filters and ORDER BYs. Filters are then re-added for every log context column that is matched in the log row. These filters will match a column using the
=
operator with the exact value from the selected row. These context columns can be configured on the datasource config page.A time range filter is also added based on the selected time column. An
ORDER BY
andLIMIT
are also added. Two queries are generated in each direction of the log row. You can scroll up and down in either direction to load more pages from the last timestamp offset.Log Context Column Configuration:
Log context columns should be the minimum number of columns required to narrow your log row to a single source. For most datasets this will likely be some combination of a service name, host name, container ID, or pod name. Keep in mind that this should also match your ClickHouse table's primary key for optimal performance.
You must
SELECT
at least one of these context columns in order for the feature to work. The columns must be selected in order to read the value for filtering. If columns are not configured, or none are matched, the following warning is displayed:For faster query building, you may enable the Auto-Select Columns setting. This will automatically include the context columns in your
SELECT
, even if OTel is enabled.When your log row matches your context columns, they will be shown at the top where they can be easily copied.
A note for
Map
columnsUse bracket syntax in the config. If your context columns are defined as
ResourceAttributes['container.id']
andResourceAttributes['host.name']
, you can simply selectResourceAttributes
and the plugin will be able to match multiple keys inside the map. Individual field selection works too. Without an alias ClickHouse will name thesearrayElement(ResourceAttributes, 'container.id')
, but the plugin will still identify these.