JSON Parsing Issue with Logs in Signoz
TLDR Androw had trouble parsing logs with JSON in Signoz. nitya-signoz suggested changes to config, which resolved the issue after Androw added the missing field 'logsCollection'.

May 15, 2023 (4 months ago)
Androw
12:49 PMneed to parse the body
{
"timestamp": 1684154685443880400,
"id": "2PpWeXe4qjcHXfMZxu0FL86HjVg",
"trace_id": "",
"span_id": "",
"trace_flags": 0,
"severity_text": "",
"severity_number": 0,
"body": "{\"level\":\"info\",\"ts\":1684154685.4437983,\"logger\":\"controllers.webhook-certs-updater\",\"msg\":\"ignoring webhook due to missing labels\",\"Webhookconfig\":\"/istiod-default-validator\",\"":\"webhook\"}",
"resources_string": {
"k8s_cluster_name": "",
"k8s_container_name": "",
"k8s_container_restart_count": "",
"k8s_deployment_name": "",
"k8s_namespace_name": "",
"k8s_node_name": "",
"k8s_pod_name": "",
"k8s_pod_start_time": "",
"k8s_pod_uid": ""
},
"attributes_string": {
"log_file_path": "",
"log_iostream": "stderr",
"logtag": "F",
"time": ""
},
"attributes_int": {},
"attributes_float": {}
}
tried adding
- type: json_parser
parse_from: attributes.body
if: '$matches "^{.*}$"'
to the k8s-infra -> presets -> operators
using helm+argocd to deploy signoz
Androw
12:57 PMnitya-signoz
03:22 PMAndrow
03:26 PMAndrow
03:26 PMnitya-signoz
03:28 PMattributes.body to body
so it will be
- type: json_parser
parse_from: body
if: '$matches "^{.*}$"'
Androw
03:28 PMAndrow
03:54 PMnitya-signoz how can i verify that the operator that i added to the helm values is in fact added?
where should i look at?
nitya-signoz
03:56 PMAndrow
03:57 PM{
"timestamp": 1684165920042734300,
"id": "2PpsKtQJSzrNcUu9JxN7j3cgICK",
"trace_id": "",
"span_id": "",
"trace_flags": 0,
"severity_text": "",
"severity_number": 0,
"body": "{\"level\":\"info\",\"msg\":\"Done LoadModelsTask \",\"time\":\"2023-05-15T15:52:00Z\"}",
"resources_string": {
"k8s_cluster_name": "",
"k8s_container_name": "model-analysis-service",
"k8s_container_restart_count": "3",
"k8s_deployment_name": "mod1-model-analysis-service",
"k8s_namespace_name": "imubit-apps",
"k8s_node_name": "",
"k8s_pod_name": "",
"k8s_pod_start_time": "",
"k8s_pod_uid": ""
},
"attributes_string": {
"log_file_path": "/var/log/pods/imubit-apps_mod1-model-analysis-service-7b8895f9f6-lsdjs_2ec5f13f-85d1-456f-8ee0-2fd4e7eae052/model-analysis-service/3.log",
"log_iostream": "stdout",
"logtag": "F",
"time": "2023-05-15T15:52:00.042734442Z"
},
"attributes_int": {},
"attributes_float": {}
}
nitya-signoz
03:59 PM'body matches "^{.*}$"'
nitya-signoz
03:59 PMAndrow
03:59 PMAndrow
03:59 PM - type: json_parser
parse_from: body
if: 'body matches "^{.*}$"'
so this?
nitya-signoz
03:59 PMAndrow
03:59 PMnitya-signoz
04:00 PMAndrow
04:21 PMAndrow
04:21 PM "attributes_string": {
"log_file_path": "/var/log/pods/imubit-apps_mod1-model-analysis-service-7b8895f9f6-lsdjs_2ec5f13f-85d1-456f-8ee0-2fd4e7eae052/model-analysis-service/3.log",
"log_iostream": "stdout",
"logtag": "F",
"time": "2023-05-15T16:21:00.109518425Z"
},
Androw
04:22 PMnitya-signoz
04:22 PMAndrow
04:26 PMAndrow
04:28 PMMay 16, 2023 (4 months ago)
nitya-signoz
07:50 AMAndrow
08:52 AMAndrow
08:52 AMnitya-signoz
08:55 AMAndrow
08:58 AMnitya-signoz
08:59 AMAndrow
08:59 AMsignoz-otel-collector
Androw
08:59 AMAndrow
09:00 AMAndrow
09:00 AMAndrow
09:00 AMnitya-signoz
09:00 AMnitya-signoz
09:01 AMAndrow
09:07 AMk8s-infra -> presets -> operators
is this not the correct path to add the json_parser?
nitya-signoz
09:08 AMnitya-signoz
09:09 AMAndrow
09:38 AMit says here it is ignored
Androw
09:38 AMnitya-signoz
09:39 AMAndrow
10:25 AMi was missing a field
logsCollection
k8s-infra -> presets -> logsCollection -> operators
sorry and thanks for the help

SigNoz Community
Indexed 825 threads (61% resolved)
Similar Threads
Extracting Custom Fields as Attributes from Log in SigNoz
Harald wants to have custom fields from their body parsed as attributes in the SigNoz logger. They have tried implementing suggestions from nitya-signoz and Prashant, but the issue remains unsolved due to a potential race condition encountered while executing the code. They have provided a full example using Kind for further assistance.



SigNoz Log Format and JSON Parsing
Luke asked about the log format for SigNoz and using operators to convert loggers. nitya-signoz shared resources about specifications and recommended using operators. Travis had issues with JSON parsing but resolved them by updating `otel-agent-config.yaml`.

Parsing log entry and extracting fields with OTEL
Syed needed help parsing a log entry and extracting fields using OTEL. nitya-signoz provided guidance and the correct configurations, resolving the issue.


Adding Labels to Logs in SigNoz Using Pipelines
Tarek was trying to add labels from a JSON body to SigNoz logs. nitya-signoz and Shivanshu helped by providing pipeline examples and configurations. nitya-signoz's solution eventually resolved the issue.

Debugging JSON Parsing and Logging Issue with Otel-Collector
Hannes was struggling to debug log conversion to JSON and attribute parsing in otel-collector. nitya-signoz provided guidance and updates to the processors which eventually resolved the issue.
