Hello i’m setup signoz on k8 cluster for my golang project. In logs i’m able to see the body as json...
k
Hello i’m setup signoz on k8 cluster for my golang project. In logs i’m able to see the body as json string and not json object. i want it as json object so that i can filter out the logs. i followed this doc link https://signoz.io/docs/logs-pipelines/guides/json/ in pipeline when i add json parser , it doesn’t parse it add a new temp_body
n
Please share more details on what your log body looks like also share screenshot of your pipeline.
k
Copy code
{
  "body": "{\"time\":\"2024-07-10T11:08:58.609664745Z\",\"id\":\"5451ab160782b56d95029fbcf7b80a66\",\"remote_ip\":\"49.207.202.132\",\"host\":\"<http://dev-api.superleap.com|dev-api.superleap.com>\",\"method\":\"GET\",\"uri\":\"/api/health\",\"user_agent\":\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36\",\"status\":200,\"error\":\"\",\"latency\":77416,\"latency_human\":\"77.416µs\",\"bytes_in\":0,\"bytes_out\":16, \"request\":\"\", \"response\":\"\"}'",
  "id": "2j3IkoXSMAWHFqMeE5ZEzb84CbS",
  "timestamp": "2024-07-10T11:08:58.609852665Z",
  "attributes": {
    "log.file.path": "/var/log/pods/default_superleap-backend-deployment-d564cdccc-rz5qm_8ff40fa1-f8c9-4ae6-987f-2fdfd2ccd10f/superleap-backend-app/0.log",
    "log.iostream": "stderr",
    "logtag": "F",
    "time": "2024-07-10T11:08:58.609852665Z"
  },
  "resources": {
    "k8s.cluster.name": "",
    "k8s.container.name": "superleap-backend-app",
    "k8s.container.restart_count": "0",
    "k8s.deployment.name": "superleap-backend-deployment",
    "k8s.namespace.name": "default",
    "k8s.node.name": "gk3-dev-superleap-pool-3-897afe0c-m82x",
    "k8s.pod.name": "superleap-backend-deployment-d564cdccc-rz5qm",
    "k8s.pod.start_time": "2024-07-08 14:15:41 +0000 UTC",
    "k8s.pod.uid": "8ff40fa1-f8c9-4ae6-987f-2fdfd2ccd10f"
  },
  "severity_text": "",
  "severity_number": 0,
  "span_id": "",
  "trace_flags": 0,
  "trace_id": ""
}
this is my log content. i want to parse body to json so that i can use it in filter.
@nitya-signoz if we see the body content there’s a extra single quote extra in end before double quotes.
Copy code
\"response\":\"\"}'"
n
yeah that should be the cultprit, check these files i.e
/var/log/pods/default_superleap-backend-deployment-d564cdccc-rz5qm_8ff40fa1-f8c9-4ae6-987f-2fdfd2ccd10f/superleap-backend-app/0.log
and see if your application is adding that extra quote