Disable fluentd on on Container-Optimized OS (GCE)

fluentdgoogle-cloud-platformgoogle-compute-engine

I would like to disable fluentd on a VM instance running Container-Optimized OS on Google compute engine.

The reason being that it is eating up a lot of RAM for functionalities I do not require.

$ ps aux --sort -rss
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        1040  0.7 49.1 5149544 294484 ?      Sl   15:07   0:03 /opt/google-fluentd/embedded/bin/ruby -Eascii-8bit:ascii-8bit /usr/sbin/google-fluentd --under-supervisor
root         286  0.2 12.3 780428 73844 ?        Ssl  15:07   0:00 /usr/bin/dockerd --registry-mirror=https://mirror.gcr.io --host=fd:// --containerd=/var/run/containerd/containerd.sock
root         791  0.4  9.0 304208 54068 ?        Ssl  15:07   0:01 /opt/google-fluentd/embedded/bin/ruby /usr/sbin/google-fluentd
root         334  0.0  7.3 609056 44100 ?        Ssl  15:07   0:00 /usr/bin/docker run --rm --name=stackdriver-logging-agent -v /etc/stackdriver/logging.config.d/:/etc/google-fluentd/config.d/ -v /var/log:/var/log 
root         333  0.0  7.3 535324 43820 ?        Ssl  15:07   0:00 /usr/bin/docker events

The process is linked to this systemd service.

$ systemctl status stackdriver-logging.service
● stackdriver-logging.service - Fluentd container for Stackdriver Logging
   Loaded: loaded (/usr/lib/systemd/system/stackdriver-logging.service; static; vendor preset: disabled)
   Active: active (running) since Mon 2019-08-26 12:27:03 UTC; 1min 6s ago
  Process: 335 ExecStartPre=/bin/mkdir -p /var/log/google-fluentd/ (code=exited, status=0/SUCCESS)
 Main PID: 337 (docker)
    Tasks: 7 (limit: 664)
   Memory: 35.6M
      CPU: 81ms
   CGroup: /system.slice/stackdriver-logging.service
           └─337 /usr/bin/docker run --rm --name=stackdriver-logging-agent -v /etc/stackdriver/logging.config.d/:/etc/google-fluentd/config.d/ -v /var/log:/var/log -v /var/lib/docker/containers/:/var/lib/docker/containers/ gcr.io/stackdriver-agents/stackdriver-logging-agent:0.2-1.5.33-1-1

However if I try to disable it using:

$ sudo systemctl disable --now stackdriver-logging.service

The disabling doesn't survive a restart of the VM.

Best Answer

Try editing the the Custom metadata values. You should have two of them set as true (google-logging-enabled and google-monitoring-enabled). Set them to false and look into the instance to check if the other containers (Stackdriver related) are not running.

Related Topic