How to remove quotes and backslashes in message field? #2024
-
Hi there!
(or nicely formatted) {
"ts": "2025-04-16T13:54:40.175887Z",
"time": "2025-04-16T16:54:40.175887931+01:00",
"stream": "stdout",
"logtag": "F",
"message": "{\"log_source\":\"nginx-unit\",\"remote_addr\":\"172.19.112.49\",\"time_local\":\"16/Apr/2025:16:54:40 +0100\",\"method\":\"PATCH\",\"request_uri\":\"/api/dcim/sites/28287/\",\"status\":\"200\",\"body_bytes_sent\":\"581\",\"request_time\":\"0.152\",\"header_user_agent\":\"python-urllib3/2.4.0\"}",
"kubernetes": {
"pod_name": "netbox-dev-5654d7f9cf-hjmrg",
"namespace_name": "netbox-dev",
"pod_id": "56e93116-4d8b-43ce-9e47-ad68e2a9cf34",
"labels": {
"[app.kubernetes.io/instance": "netbox-dev",
"app.kubernetes.io/managed-by": "Helm",
"app.kubernetes.io/name": "netbox",
"app.kubernetes.io/version": "4b57b164",
"helm.sh/chart": "netbox-0.1.7",
"pod-template-hash": "5654d7f9cf"
},
"annotations": {
"cni.projectcalico.org/containerID": "a111a777d36daaf407f1b41c1a2643251edde343febbc8b21bdec6f10e8291e8",
"cni.projectcalico.org/podIP": "10.233.109.175/32",
"cni.projectcalico.org/podIPs": "10.233.109.175/32",
"kubectl.kubernetes.io/restartedAt": "2025-03-21T15:56:26+07:00"
},
"host": "test-cluster",
"container_name": "netbox-dev",
"docker_id": "5865acc45ddda342e606df1ed8e7401519db75661a9953481e38b33349bfdf09",
"container_hash": "registry.lan/netbox/netbox-dev@sha256:d39dd6aa2ed9b127376dec1bd58bcd312a2b5000a6098db1db1b2d2bb99da7b2",
"container_image": "registy.lan/netbox/netbox-dev:4b57b164"
},
"kubernetes_namespace": {
"name": "netbox-dev",
"labels": {
"kubernetes.io/metadata.name": "netbox-dev"
}
}
} But because of quotes around message field Splunk can't extract values from nested json, can I disable them somehow? Or even maybe specify my own template? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I beleive there are two ways to solve this:
|
Beta Was this translation helpful? Give feedback.
-
also you can use https://docs.fluentd.org/filter/record_transformer#enable_ruby to unescape the message using ruby I beleive |
Beta Was this translation helpful? Give feedback.
I beleive there are two ways to solve this: