0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Fluentd(td-agent)のインストールからログ出力まで

Last updated at Posted at 2019-09-04

#はじめに
CentOSにFluentd(td-agent)をインストールして、連携させるデータをPOSTしてログで確認するまでの手順です

#環境
CentOS 7.2.1511
※自分は、MacOS上のCentOSで動かしています
macOS+Vagrant(CentOS)でpysparkを動かす

#td-agentのインストール

$ sudo su -
# curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent3.sh | sh

#td-agentの起動とその確認

# systemctl start td-agent
# systemctl status td-agent

#td-agentへデータ送信とログの確認

# curl -X POST -d 'json={"test":"hoge"}' http://localhost:8888/debug.test
# cat /var/log/td-agent/td-agent.log
2019-09-04 02:18:36.710158181 +0100 debug.test: {"test":"sample"}

#ログを指定したディレクトリに書き出す
※/etc/td-agent/td-agent.confに追記

# vi /etc/td-agent/td-agent.conf

<filter sample.**>
  @type  grep
  <regexp>
    key       test
    pattern   hoge
  </regexp>
</filter>

<match sample.**>
  @type  file
  @id    out_file_sample
  path   /var/log/td-agent/sample
</match>

#td-agent再起動

# systemctl restart td-agent

#データ送信とログ確認

# curl -X POST -d 'json={"test":"hoge"}' http://localhost:8888/sample.test
# tail /var/log/td-agent/sample/*.log
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?