LoginSignup
2
0

More than 5 years have passed since last update.

AmazonLinux2.xでFluentdをrootユーザで実行する

Last updated at Posted at 2018-06-05

概要

Amazon Linux 2.x(ami-2724cf58)でtd-agent(v3.1.1-0.el2)をroot権限で実行する方法を残したいと思います
※CentOS7.xも共通なのかは未検証
以下の方法以外にもやり方がありましたら、ご教授いただければ幸いです

やりかた

  1. Amazon Linux 2.xではサービスはすべてsystemctlが管理しているので、td-agent.serviceのUserとGroupをrootに変更

    /lib/systemd/system/td-agent.service
    [Service]
    User=root
    Group=root
    ~~ 中略 ~~
    ExecStart=/opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent.pid
    ExecStop=/bin/kill -TERM ${MAINPID}
    ExecReload=/bin/kill -HUP ${MAINPID}
    Restart=always
    TimeoutStopSec=120
    
    [Install]
    WantedBy=multi-user.target
    
    
  2. serviceファイルの変更をsystemctlに適用する

    > systemctl daemon-reload
    
  3. td-agent serviceの(再)起動

気になること

Amazon Linux 1.x の実行パラメータに--use-v1-config があったが、2.xにはない
追加する場合は、上記のtd-agent.serviceのExecStartに追加すればOK

2
0
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
2
0