2

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?

mbxzxz
  • 366
  • 2
  • 14
  • Does this answer your question? [GCP Log explorer shows wrong severity level of log records](https://stackoverflow.com/questions/71158475/gcp-log-explorer-shows-wrong-severity-level-of-log-records) – Atef Hares Jul 25 '22 at 11:55
  • @AtefHares, no this doesn't answer, in that use case the data is already present in a JSON format. My use case is to convert/parse CSV to JSON – mbxzxz Jul 25 '22 at 13:17
  • @mayankb You can select various Levels of severity(Critical,Emergency)in logs explorer, Check whether the severity option is error type in logs explorer you can change that to debug for the logs that you have generated and you can convert that to CSV or Json format. Please find this [document](https://cloud.google.com/logging/docs/view/logs-explorer-interface?hl=en_US&_ga=2.111912333.-820331028.1626766507) for more information. – Ramesh kollisetty Jul 26 '22 at 09:37

1 Answers1

1

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

femeloper
  • 96
  • 7