我们可以安排StackDriver Logging导出日志吗? [英] Can we schedule StackDriver Logging to export log?

查看:189
本文介绍了我们可以安排StackDriver Logging导出日志吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Google Cloud StackDriver日志记录的新手,并且按照 Google Cloud Storage 导出日志="https://cloud.google.com/logging/docs/quickstart-sdk" rel ="nofollow noreferrer"> Cloud SDK ,以及使用

I am new to Google Cloud StackDriver Logging and as per this documentation StackDriver stores the Data Access audit logs for 30 days. Also mentioned on the same page, that Size of a log entry is limited to 100KB.
I am aware of the fact that the logs can be exported Google Cloud Storage using Cloud SDK as well as using Logging Libraries in many languages (we prefer Python).
I have two questions related to the exporting the logs, which are:

  1. StackDriver中有什么方法可以安排类似于任务或cronjob的任务,这些任务或cronjob在固定的时间间隔后会继续自动将日志导出到Google Cloud存储中?
  2. 大于100KB的日志条目会发生什么情况.我认为他们被截断了.我的假设正确吗?如果是,是否可以通过任何方式导出/查看完整(完全没有被截断的)日志条目?

推荐答案

StackDriver中是否可以安排类似于 不断在Google Cloud中导出日志的任务或cronjob 在固定的时间间隔后会自动存储吗?

Is there any way in StackDriver to schedule something similar to a task or cronjob that keeps exporting the Logs in the Google Cloud storage automatically after a fixed interval of time?

Stackdriver支持通过sinks导出日志数据.您没有可以设置的时间表,因为一切都是自动的.基本上,数据是as soon as possible导出的,您无法控制每个接收器的导出数量或两次导出之间的延迟.我从来没有发现这是一个问题.根据设计,日志记录不能用作实时系统.最接近的是下潜到PubSub,后者有几秒钟的延迟(根据我的经验).

Stackdriver supports exporting log data via sinks. There is no schedule that you can set as everything is automatic. Basically, the data is exported as soon as possible and you have no control over the amount exported at each sink or the delay between exports. I have never found this to be an issue. Logging, by design, is not to be used as a real-time system. The closest is to sink to PubSub which has a couple of second delay (based upon my experience).

有两种方法可以从Stackdriver导出数据:

There are two methods to export data from Stackdriver:

  1. 创建一个导出接收器.支持的目的地是BigQuery,Cloud Storage和PubSub.日志条目将自动写入目标.然后,您可以使用工具来处理导出的条目.这是推荐的方法.
  2. 使用Python,Java等编写自己的代码,以读取日志条目并对其进行所需的操作.计划由您决定.此方法是手动的,需要您管理时间表和目的地.

大于100KB的日志条目将如何处理.我假设 他们被截断了.我的假设正确吗?如果可以,有什么办法 我们可以在其中导出/查看完整内容(完全不会被截断) 日志条目?

What happens to the log entries which are larger than 100KB. I assume they get truncated. Is my assumption correct? If yes, is there any way in which we can export/view the full(which is not at all truncated) Log entry?

超出条目最大大小的条目无法写入Stackdriver.尝试创建条目的API调用将失败,并显示类似(Python错误消息)的错误消息:

Entries that exceed the max size of an entry cannot be written to Stackdriver. The API call that attempts to create the entry will fail with an error message similar to (Python error message):

400 Log entry with size 113.7K exceeds maximum size of 110.0K

这意味着太大的条目将被丢弃,除非作者具有处理这种情况的逻辑.

This means that entries that are too large will be discarded unless the writer has logic to handle this case.

这篇关于我们可以安排StackDriver Logging导出日志吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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