mbxzxz
mbxzxz

Reputation: 425

GCP Logs Explorer parse textPayload

I have a service which generates logs in the below format

2022-07-25T06:31:52.909705Z, DEBUG, foo.fooApplication, using localDB path /config/LocalDB
2022-07-25T06:31:52.966801Z, DEBUG, localdb.LocalDBFactory, initializing password.foo.util.localdb.XodusLocalDB localDBProvider instance

GCP Logs explorer reads this as below

[
  {
    "textPayload": "2022-07-25T05:38:41.012837Z, DEBUG, foo.fooApplication, using localDB path /config/LocalDB",
    "timestamp": "2022-07-25T05:38:41.013044676Z",
    "severity": "ERROR",
    "receiveTimestamp": "2022-07-25T05:38:46.103891084Z"
  },
  {
    "textPayload": "2022-07-25T05:38:41.018544Z, DEBUG, localdb.LocalDBFactory, initializing password.foo.util.localdb.XodusLocalDB localDBProvider instance",
    "timestamp": "2022-07-25T05:38:41.018744665Z",
    "severity": "ERROR",
    "receiveTimestamp": "2022-07-25T05:38:46.103891084Z"
  }
]

textPayload has severity as DEBUG and GCP marks it as ERROR. Is there a way to parse severity from textPayload?

Upvotes: 2

Views: 1691

Answers (1)

femeloper
femeloper

Reputation: 96

textPayload=~DEBUG will find logs where "DEBUG" exists in the textPayload

Upvotes: 1

Related Questions