简体   繁体   中英

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

I have gone though documentation for installing stackdriver agent on linux .

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 "

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 ?

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. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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