Google Cloud Professional Cloud DevOps Engineer — Question 141
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?
Answer options
- 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.
Correct answer: A
Explanation
The correct answer is A because modifying the application to use the Cloud Logging SDK allows for structured logging with a jsonPayload field, which is specifically designed for this purpose. Options B and D suggest using additional components or configurations that may not directly achieve the conversion to structured logs as effectively as the SDK. Option C is incorrect as it involves a log agent that is not necessary when the SDK can handle the logging requirements.