grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.92k stars 3.45k forks source link

Ability to export all labels on every log line #5702

Open riclib opened 2 years ago

riclib commented 2 years ago

Is your feature request related to a problem? Please describe. Being able to reliably import data exported by logcli into other systems

Describe the solution you'd like a command line flag to keep all labels in every output line

Describe alternatives you've considered when exporting, the labels vary based on the limit. so each group will have only it's unique labels. Tried increasing limit but export still unreliable.

cstyan commented 2 years ago

Just to confirm, this is a logcli specific request?

Can you also provide an example of the current logcli output and your expected output

stale[bot] commented 2 years ago

Hi! This issue has been automatically marked as stale because it has not had any activity in the past 30 days.

We use a stalebot among other tools to help manage the state of issues in this project. A stalebot can be very useful in closing issues in a number of cases; the most common is closing issues or PRs where the original reporter has not responded.

Stalebots are also emotionless and cruel and can close issues which are still very relevant.

If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry.

We regularly sort for closed issues which have a stale label sorted by thumbs up.

We may also:

We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, our sincere apologies if you find yourself at the mercy of the stalebot.

dbirks commented 2 years ago

I think I see what the original poster was talking about. If the labels are all the same, logcli will put them in the Common labels section at the top, and put an empty {} for each line in the log output.

logcli query '{namespace="monitoring",app="loki"}' --limit 5   

2022-10-03_21-11

I think with a new flag like --all-labels or something like that, we could make logcli output all labels in the log output for consistent parsing by other tools. Here's an example of what that output could look like. I convinced xargs to put multiple --include-label flags for all labels output by logcli labels:

logcli query '{namespace="monitoring",app="loki"}' --limit 5 $(logcli labels | xargs --max-lines=1 echo --include-label | xargs) 

2022-10-03_21-13

I'd be interested in giving a PR a shot if this looks like something helpful.

msherman13 commented 3 months ago

Has anyone made progress on this?