Loki json data How do I label separately?

Hello guys ı have a question

I’ve just started learning grafana and loki, but there’s something I can’t figure out

I have json logs and I want to show them as separate tags in the table, how do I do this?
Is there a way to do this with query?

{ “_timestamp”: “2024-04-12T15:03:40.681Z”, “ecs_version”: “1.6.0”, “filename”: “/app/logs/app.log”, “job”: “json-logs”, “log_level”: “info”, “log_logger”: “test”, “log_origin_file_line”: “19”, “log_origin_file_name”: “register_response_time.py”, “log_origin_function”: “after_request”, “log_original”: “10.040044784545898 ms POST /api/login {}”, “message”: “10.040044784545898 ms POST /api/login {}”, “process_name”: “MainProcess”, “process_pid”: “10”, “process_thread_id”: “130752663564544”, “process_thread_name”: “Dummy-3” }

loki:2.8.7
grafana:10.2.3

Try the json filter, perhaps. See examples here: LogQL: Log query language | Grafana Loki documentation

image

Thanks for your answer. I used the json filter, the only thing I want is to label this json data separately with query, is there a way to do this with query?

I am not sure what you are looking to achieve. Can you share some examples logs and what results you want to see?

Actually, what I want to do is that I use the following panel title and all my data comes in a single tag as json. I want to label my json data separately

image

label1
_timestamp
label2
ecs_version
etc.

{ “_timestamp”: “2024-04-12T15:03:40.681Z”, “ecs_version”: “1.6.0”, “dosya adı”: “/app/logs/app.log”, “job”: "json- logs”, “log_level”: “info”, “log_logger”: “test”, “log_origin_file_line”: “19”, “log_origin_file_name”: “register_response_time.py”, “log_origin_function”: “after_request”, “log_original”: “ 10.040044784545898 ms POST /api/login {}”, “message”: “10.040044784545898 ms POST /api/login {}”, “process_name”: “MainProcess”, “process_pid”: “10”, “process_thread_id”: “130752663564544” , “işlem_iş parçacığı_adı”: “Sahte-3” }

Unless I am misunderstanding something, that’s what json filter does. See LogQL Analyzer | Grafana Loki documentation