Extract Value From JSON Body

TLDR Tarek needed help to extract 'tenantId' value from a JSON log body but experienced an issue in clickhouse. nitya-signoz informed that it was a known issue and would be fixed with the next clickhouse upgrade.

Photo of Tarek
Tarek
Wed, 16 Aug 2023 21:11:07 UTC

Hi, i need to get value from body, the log body is already in JSON ```{ "name": "xxx", "hostname": "xxx-xxx-644d656d99-c24x5", "pid": 17, "component": "nodeWorkerSQS", "level": "INFO", "messageType": "integration_process", "body": { "type": "integration_process", "integrationType": "twitter", "tenantId": "xxxx", "onboarding": false, "integrationId": "xxxx", "retryStreams": [ { "id": "xxxxx", "retryCount": 1, "stream": { "value": "mentions", "metadata": { "page": "" } } } ], "remainingStreams": [ { "value": "followers", "metadata": { "page": "" } } ] }, "msg": "Sending xxx sqs message!", "time": "2023-08-16T12:09:25.868Z", "v": 0 }``` I want to get something like tenantId the path for it body.body.tenantId

Photo of nitya-signoz
nitya-signoz
Thu, 17 Aug 2023 03:36:03 UTC

Photo of Tarek
Tarek
Sat, 19 Aug 2023 00:28:46 UTC

nitya-signoz, I have this issue ```2023.08.19 00:14:57.033379 [ 56 ] {1b2a2e8d-53b5-450c-9dd4-7f956fd72e9a::20230813_11848_11848_0_534597} <Error> MutatePlainMergeTreeTask: Code: 10. DB::Exception: Not found column tenantId in block. There are only columns: timestamp, id, body, k8s_cluster_name, observed_timestamp, trace_id, span_id, trace_flags, severity_text, severity_number, resources_string_key, resources_string_value, attributes_string_key, attributes_string_value, attributes_int64_key, attributes_int64_value, attributes_float64_key, attributes_float64_value. (NOT_FOUND_COLUMN_IN_BLOCK) (version 22.8.8.3 (official build)) 2023.08.19 00:14:57.036610 [ 56 ] {1b2a2e8d-53b5-450c-9dd4-7f956fd72e9a::20230813_11848_11848_0_534597} <Error> virtual bool DB::MutatePlainMergeTreeTask::executeStep(): Code: 10. DB::Exception: Not found column tenantId in block. There are only columns: timestamp, id, body, k8s_cluster_name, observed_timestamp, trace_id, span_id, trace_flags, severity_text, severity_number, resources_string_key, resources_string_value, attributes_string_key, attributes_string_value, attributes_int64_key, attributes_int64_value, attributes_float64_key, attributes_float64_value. (NOT_FOUND_COLUMN_IN_BLOCK), Stack trace (when copying this message, always include the lines below):``` in clickhouse

Photo of nitya-signoz
nitya-signoz
Sat, 19 Aug 2023 12:38:48 UTC

This is a known issue, it will be fixed with clickhouse upgrade, expect it around next week

Photo of Tarek
Tarek
Sat, 19 Aug 2023 12:51:41 UTC

Thank you