前提・実現したいこと
GCPにて、
Cloud Run上で動いているソースでエラー時にconsole.log()を入れ、
その結果をエラーレポート → slack通知まで行いたいです。
slack通知に関してはできたので、
console.log()の結果をエラーレポートに反映させるところでつまづいています。
試したこと
以下のように、console.log()にseverity
, message
, detect_json
を設定し、
(messageの内容はライブラリ等から自動で吐き出されるものではなく、手書きしたのを反映したいです)
console.log(JSON.stringify({"severity": "ERROR", "message": "error:errorLogTest", "detect_json": true}));
ロギングでは、以下のように出力され、アイコンは!!
になっていますが、
エラーレポートには反映されません。
{ insertId: "xxxxxx" jsonPayload: { detect_json: true message: "error:errorLogTest" } labels: { instanceId: "xxxxxx" } logName: "projects/xxxxxx/logs/run.googleapis.com%2Fstdout" receiveTimestamp: "2021-11-05T03:24:01.705914566Z" resource: { labels: { configuration_name: "xxxxxx" location: "asia-northeast1" project_id: "xxxxxx" revision_name: "xxxxxx" service_name: "xxxxxx" } type: "cloud_run_revision" } severity: "ERROR" timestamp: "2021-11-05T03:24:01.369429Z" }
ご教授の程、よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。