Your Cloud Run application writes unstructured logs as text strings to Cloud Logging. You want to convert the unstructured logs to JSON-based structured logs. What should you do?
A. Modify the application to use Cloud Logging software development kit (SDK), and send log entries with a jsonPayload field.
B. Install a Fluent Bit sidecar container, and use a JSON parser.
C. Install the log agent in the Cloud Run container image, and use the log agent to forward logs to Cloud Logging.
D. Configure the log agent to convert log text payload to JSON payload.
Disclaimer
This is a practice question. There is no guarantee of coming this question in the certification exam.
Answer
D
Explanation
A. Modify the application to use Cloud Logging software development kit (SDK), and send log entries with a jsonPayload field.
(Not helpful.)
B. Install a Fluent Bit sidecar container, and use a JSON parser.
(Unnecessary.)
C. Install the log agent in the Cloud Run container image, and use the log agent to forward logs to Cloud Logging.
(Not needed, log agent is by default part of Cloud Run deployment.)
D. Configure the log agent to convert log text payload to JSON payload.
(https://cloud.google.com/logging/docs/agent/logging/configuration#process-payload
https://cloud.google.com/logging/docs/agent/logging/configuration#structured-records
In this context, if you have unstructured logs written as text strings and want to convert them to JSON-based structured logs, you would typically use a log agent or parser to transform the log entries. The log agent is configured to recognize the structure of the logs and convert the text payload into a JSON payload.
The log agent would be responsible for parsing the unstructured logs and converting them into a structured format. This process involves specifying how to extract relevant information from the text payload and organize it into a JSON structure. It’s important to note that this approach assumes you have a log agent or parser that supports the transformation of unstructured logs to structured logs.)