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
![image](https://us1.discourse-cdn.com/grafana/original/3X/6/9/692edb02f145cff6216e11ca1db8b5de92042d67.png)
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](https://us1.discourse-cdn.com/grafana/original/3X/c/d/cdff1770e05c366827dc56faccc2b5ea15565bcd.png)
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