简体   繁体   English

GCP Stackdriver日志记录:如何将日志放入“全局”部分?

[英]GCP Stackdriver logging: How to put logs in “Global” section?

I have gone though documentation for installing stackdriver agent on linux . 我已经阅读了在Linux上安装stackdriver agent的文档。

With similar configuration as below of fluentd 具有以下类似的配置

$ cat /etc/google-fluentd/config.d/test-structured-log.conf
<source>
    @type tail
    format json
    path /tmp/test-structured-log.log
    pos_file /var/lib/google-fluentd/pos/test-structured-log.pos
    read_from_head true
    tag structured-log
</source>

But my logs are shown in " GCE VM Instace > My-Instance > structured-log " 但是我的日志显示在“ GCE VM Instace>我的实例>结构化日志 ”中

I'm not able to find documentation where I can set logs in "Global" resource as shown below. 我找不到可以在“全局”资源中设置日志的文档,如下所示。

在此处输入图片说明

How can I configure my linux instance to put logs in Global ? 如何配置Linux实例以将日志放入Global

Apparently, what you want to do is change the resource type associated to your logs entries. 显然,您要做的是更改与日志条目关联的资源类型。 Now Stackdriver is showing exactly the right resource, "GCE VM Instace > Instance-Name > structured-log" so in my opinion that's the best decision. 现在,Stackdriver正在显示正确的资源,“ GCE VM Instace>实例名称>结构化日志”,因此我认为这是最好的决定。 Global , is a resource type used to indicate that a log is not associated with any specific resource. 全局 ,是一种资源类型,用于指示日志未与任何特定资源关联。

If you still want to change it, you will have to explicitly set the resource on your logs entries. 如果仍要更改它,则必须在日志条目上显式设置资源。 See 1 and 2 . 参见12

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM