LoginSignup
5
5

More than 5 years have passed since last update.

td-agentのファイル読み込み設定

Last updated at Posted at 2013-10-11

Apache

パッケージ

$ sudo yum -y install httpd

パッケージインストール後、Apacheのログのオーナーはroot。

$ ls -ld /var/log/httpd
drwx------ 2 root root 4096 Oct 11 13:14 /var/log/httpd

そのため、td-agentグループを追加し、読み込みと実行権を与える。

変更前

$ ls -ld /var/log/httpd
drwx------ 2 root root 4096 Oct 11 13:14 /var/log/httpd

実行

$ sudo chgrp td-agent /var/log/httpd/
$ sudo chmod g+rx /var/log/httpd/

変更後

$ ls -ld /var/log/httpd
drwxr-x--- 2 root td-agent 4096 Oct 11 13:14 /var/log/httpd

MySQL

パッケージ

$ sudo yum -y install mysql-server

パッケージインストール後、MySQLのログのオーナーはmysql。
initスクリプト実行時にグループをmysqlに戻してしまうため、groupを変更しない。
変わりに、mysqlにtd-agentのグループを追加する。

$ ls -l /var/log/mysqld.log 
-rw-r----- 1 mysql mysql 3432 Oct 11 15:43 /var/log/mysqld.log

変更前

$ cat /etc/group | grep mysql
mysql:x:27:

実行

$ usermod -G mysql td-agent

変更後

$ cat /etc/group | grep mysql
mysql:x:27:td-agent

syslog

ファイルのオーナーはrootのため、グループにtd-agentを加える。

変更前

$ ls -l /var/log/messages 
-rw------- 1 root root 73171 Oct 11 15:47 /var/log/messages

実行

$ sudo chgrp td-agent /var/log/messages
$ sudo chmod g+rx /var/log/messages

変更後

$ ls -l /var/log/messages 
-rw-r-x--- 1 root td-agent 87451 Oct 11 15:52 /var/log/messages
5
5
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
5