如何在Stackdriver中导出以前的日志 [英] How to export previous logs in Stackdriver

查看:57
本文介绍了如何在Stackdriver中导出以前的日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Stackdriver中有一个日志,该日志记录了每个请求进入我的api并失败的情况,并且我想编写一个脚本来依靠每个错误消息出现的次数.问题是,Stackdriver V2中的导出功能仅允许我接收即将出现的错误消息,但我只关心已经存在于日志中的日志条目.有没有办法从Stackdriver下载完整日志?

I have a log in Stackdriver that logs every request goes into my api and failed, and I want to write a script to count on the number of times each error message appears. The problem is, the export feature in Stackdriver V2 only allow me to sink upcoming error messages, but I only care about the logs entries that already lives in the log. Is there a way to download the complete log from Stackdriver?

推荐答案

您现在可以使用gcloud logging read通过gcloud CLI工具执行此操作:

You can now do this from the gcloud CLI tool, with gcloud logging read: https://cloud.google.com/logging/docs/reference/tools/gcloud-logging#reading_log_entries

尽管在上述情况下,创建日志接收器是捕获早于stackdriver日志窗口(即使在付费版本中也只有30天)的事件的唯一方法.

Though in the scenario described, creating a log sink is the only way to capture events that are older than the stackdriver logging window, which is only 30 days even in the paid version.

这篇关于如何在Stackdriver中导出以前的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆