LoginSignup
5
1

More than 1 year has passed since last update.

google-fluentdのログが容量食いまくってた

Last updated at Posted at 2019-02-28

概要

GCEで稼働しているサーバ(CentOS7)のディスクが妙に減っているので、見てみたところgoogle-fluentdが悪さしていた。

ディスクの容量確認

rootボリュームとして50GBのPersistent Diskをアタッチしている。
Apache+Tomcatが稼働していて、Tomcatとかのログローテも入れてるのに妙に容量食っている。

$ df -h
ファイルシス   サイズ  使用  残り 使用% マウント位置
/dev/sda1         50G   20G   31G   40% /
devtmpfs         3.6G     0  3.6G    0% /dev
tmpfs            3.6G     0  3.6G    0% /dev/shm
tmpfs            3.6G  337M  3.3G   10% /run

どこが容量を食っているか調べる

あれ?どこもたいして容量食ってなくない?っていうか全然数字が合わなくない?

# du -sh /*
0   /bin
88M /boot
0   /dev
34M /etc
221M    /home
0   /lib
0   /lib64
0   /media
0   /mnt
1.6G    /opt
0   /proc
200K    /root
337M    /run
0   /sbin
0   /srv
0   /sys
96K /tmp
2.0G    /usr
1007M   /var

原因を調べる

lsでも出てこないし、どういうことだ・・・と思って、ファイルディスクリプタを確認。

google-fluentdお前か!

# ls -al /proc/*/fd/* | grep deleted

l-wx------ 1 root    root    64  2月 23 15:31 /proc/6733/fd/7 -> /var/log/google-fluentd/google-fluentd.log.1 (deleted)

対応方法

google-fluentdを再起動

# systemctl restart google-fluentd

解決

# df -h
ファイルシス   サイズ  使用  残り 使用% マウント位置
/dev/sda1         50G  4.8G   46G   10% /
devtmpfs         3.6G     0  3.6G    0% /dev
tmpfs            3.6G     0  3.6G    0% /dev/shm
tmpfs            3.6G  337M  3.3G   10% /run
tmpfs            3.6G     0  3.6G    0% /sys/fs/cgroup
tmpfs            732M     0  732M    0% /run/user/1007
tmpfs            732M     0  732M    0% /run/user/1002
tmpfs            732M     0  732M    0% /run/user/0

それでもダメな場合・・・

google-fluentdを停止して、削除する

systemctl stop google-fluentd
rm -f /var/log/google-fluentd/google-fluentd.log
systemctl stop google-fluentd
5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1