Comments (4)
Going to close as a dupe of #88, although not quite the same the solutions are consistent - we want to extract data from the log lines themselve into labels. A good example is log level.
from loki.
How exactly is the current solution implemented? I assume it is implemented client side and Grafana parse every logline for a log level (warn, info, ...)? But I haven't found the relevant code yet.
Edit: Found it: https://github.com/grafana/grafana/blob/e1acc772979e4dd8db4fbaeda58b842991c00f99/packages/grafana-data/src/types/logs.ts#L9
from loki.
To have the log level as a label, it must be done by the logging agent, e.g., Promtail is doing it via pipelines: https://github.com/grafana/loki/blob/master/docs/clients/promtail/pipelines.md
Grafana cannot create its own set of labels. It does two different, additional things: using the level
label (if present) as a hint to color the log volume histogram. If it cannot find level
as a label, it parses each log line like you described. The other thing grafana does is parse log lines into fields, i.e., JSON or logfmt structured logs. Those fields are then shown separately when expanding a single log row in Explore.
from loki.
Grafana cannot create its own set of labels. It does two different, additional things: using the
level
label (if present) as a hint to color the log volume histogram. If it cannot findlevel
as a label, it parses each log line like you described. The other thing grafana does is parse log lines into fields, i.e., JSON or logfmt structured logs. Those fields are then shown separately when expanding a single log row in Explore.
Thanks for the explanation :)
For anyone else stumbling on this issue and wondering how it is implemented, the relevant code is here:
https://github.com/grafana/grafana/blob/e1acc772979e4dd8db4fbaeda58b842991c00f99/packages/grafana-data/src/types/logs.ts#L9
https://github.com/grafana/grafana/blob/e1acc772979e4dd8db4fbaeda58b842991c00f99/public/app/core/logs_model.ts#L298-L300
https://github.com/grafana/grafana/blob/e1acc772979e4dd8db4fbaeda58b842991c00f99/public/app/core/logs_model.ts#L314-L320
https://github.com/grafana/grafana/blob/e1acc772979e4dd8db4fbaeda58b842991c00f99/packages/grafana-data/src/utils/logs.ts#L13-L42
The other thing grafana does is parse log lines into fields, i.e., JSON or logfmt structured logs. Those fields are then shown separately when expanding a single log row in Explore.
Explained here: https://grafana.com/blog/2019/11/25/grafana-v6.5-released/#explore-logs-log-row-details
from loki.
Related Issues (20)
- Backend deletes tsdb files before compacting them
- Implement LogQL Template Functions for Humanizing Values
- Which version is otel GA? HOT 1
- Ingesting logs to Loki using OpenTelemetry Collector with GRPC HOT 1
- The `limits_config.max_structured_metadata_entries_count` config is not being reconized HOT 3
- helm chart ignores http_config for ruler storage configuration HOT 1
- promtail startup error
- Minio dependency in Helm Chart outdated - slightly incompatible
- Loki DDOSed proxy when the requests are rejected by the proxy
- Docker: use command instead of entrypoint
- query error parse error at line 1, col 3: syntax error: unexpected IDENTIFIER, expecting = or =~ or !~ or !=
- Can I disable these logs? HOT 1
- loki2.9.0日志被自动清理 [logs are automatically cleaned]
- querier component: error getting addresses from ring HOT 4
- HTTP2 transport
- Leave config compactor.shared_store empty changed index directory structure
- compactor.shared_store and compactor.delete_request_store not support named_stores.
- [loki-distributed] Unexpected Shutdown Causes Loki Distributed System in HA Configuration to Malfunction
- The logs volume query has timed out
- Docs feedback: /docs/sources/send-data/promtail/installation.md
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loki.