[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[],[],null,["# Send execution logs to Cloud Logging\n\nWorkflows automatically generates *execution logs* for\n[workflow executions](/workflows/docs/executing-workflow) in Cloud Logging.\n\nYou can also enable *call logging* . Or, you can create *custom logs* that use\nthe `sys.log` function in your source. Call logging and custom logs let you\ncontrol when logs are sent to Logging during a workflow execution\nand can be particularly helpful when debugging your workflow.\n\nFor details, including the `engine_call` and `executions_system` logging proto\nfiles, see this [GitHub repository](https://github.com/googleapis/googleapis/blob/master/google/cloud/workflows/type).\n\nExecution logs\n--------------\n\nEach workflow execution automatically triggers at least two execution logs:\none at the start of an execution and one at the end.\n\nFor more information about the Workflows platform logs that\nare available in Logging, see [Google Cloud platform logs](/logging/docs/api/platform-logs#workflows).\n\nCall logging\n------------\n\nYou can set a flag so that each [call step](/workflows/docs/reference/syntax/calls)\nduring the execution of your workflow is logged, and step names, function names,\nfunction arguments, and call responses are returned. Or, you can log any\nexceptions that are caught, or that stop a call.\n\nOnly explicit call steps are logged; for example, calls to subworkflows or\nlibrary functions. Calls from within expressions, or within standard\nlibrary functions (for example, `http.post` in `sys.log`), and inside connectors\nare *not* logged.\n\nHTTP `Authorization` request headers are redacted from the logs for HTTP calls.\n\nWhen applying call logging to a\n[workflow definition](/workflows/docs/creating-updating-workflow#create_a_workflow)\nor to the\n[execution of a workflow](/workflows/docs/executing-workflow#execute_a_workflow),\nyou can specify the level of logging required. The execution log level takes\nprecedence over any workflow log level, unless the execution log level is not\nspecified (the default); in that case, the workflow log level applies.\n\nNote that the [log entry size limit](/logging/quotas) set by Cloud Logging\nalso applies to call logging.\n\nCustom logs\n-----------\n\nTo create a log entry in Logging during a workflow execution,\ndefine a step in the workflow that makes a call to the standard library `sys.log`\nfunction:\n\n\u003cbr /\u003e\n\n### YAML\n\n```yaml\n - step1:\n assign:\n - varA: \"Hello\"\n - varB: \"World\"\n - logStep:\n call: sys.log\n args:\n text: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eTEXT\u003c/span\u003e\u003c/var\u003e\n severity: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eSEVERITY\u003c/span\u003e\u003c/var\u003e \n - step2:\n return: ${varA + \" \" + varB}\n \n```\n\n### JSON\n\n```json\n [\n {\n \"step1\": {\n \"assign\": [\n {\n \"varA\": \"Hello\"\n },\n {\n \"varB\": \"World\"\n }\n ]\n }\n },\n {\n \"logStep\": {\n \"call\": \"sys.log\",\n \"args\": {\n \"text\": \"\u003cvar translate=\"no\"\u003eTEXT\u003c/var\u003e\",\n \"severity\": \"\u003cvar translate=\"no\"\u003eSEVERITY\u003c/var\u003e\"\n }\n }\n },\n {\n \"step2\": {\n \"return\": \"${varA + \" \" + varB}\"\n }\n }\n ]\n \n```\n\n\u003cbr /\u003e\n\nWhen creating a log entry, define the following:\n\n- \u003cvar translate=\"no\"\u003eTEXT\u003c/var\u003e: required. The text to be logged. If you need to log the values of a map, use `${json.encode_to_string(myMap)}`.\n- \u003cvar translate=\"no\"\u003eSEVERITY\u003c/var\u003e: optional. The severity level of the log entry. For example, `INFO`, `WARNING`, or `CRITICAL`.\n\nFor more information, see the `sys.log` [function reference](/workflows/docs/reference/stdlib/sys/log).\n\n### Required permissions\n\nTo apply call logging or send custom logs to Logging, a workflow\nmust be associated with a service account that includes the\n`logging.logEntries.create` permission (for example, the `roles/logging.logWriter`\nrole). If you need to change the service account updated with your workflow, see\n[Update a workflow](/workflows/docs/creating-updating-workflow#updating_a_workflow).\nTo learn more about creating service accounts and assigning roles, see\n[Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\nView workflow logs\n------------------\n\nYou can view logs in Workflows or in Logging.\nTo view the logs for a single workflow, use the **Logs** tab in\nWorkflows. To get an aggregate view of the logs for all\nof your workflows, use the **Logs Explorer** page in Logging.\n\n### View logs in Workflows\n\nTo view a workflow's logs in Workflows, do the following:\n\n1. In the Google Cloud console, go to the **Workflows** page:\n\n\n [Go to Workflows](https://console.cloud.google.com/workflows)\n\n \u003cbr /\u003e\n\n2. To access a workflow's logs, click the workflow's name to go\n to its **Details** page.\n\n3. To view the logs, click **Logs**.\n\n4. To filter the logs by severity, in the **Default** list, select\n the type of log to display. By default, logs of all severity\n levels are shown.\n\nThe **Logs** tab on a workflow's **Details** page displays the following types\nof logs:\n\n- Logs sent to Logging\n\n- Audit logs of any operations performed on the workflow, such as updates to\n the workflow's definition\n\n### View logs in Logging\n\nTo view logs in Logging, do the following:\n\n1. In the Google Cloud console, go to the **Logs Explorer** page: \n\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs/query)\n\n \u003cbr /\u003e\n\n2. In the **Query builder** , click **Resource** and enter `workflow`. Select\n **Cloud Workflow** from the list and click **Add**.\n\n3. Click **Run query**.\n\nTo learn more about viewing logs in Logging, see\n[Use the Logs Explorer](/logging/docs/view/logs-explorer-interface).\n\nWhat's next\n-----------\n\n- [Access workflow execution results](/workflows/docs/access-execution-results)\n- [Troubleshoot issues](/workflows/docs/troubleshooting)"]]