fluentdインストール
Fluentdのサイトのstep1,step2を実行(step3で動作確認)
タグを追加する場合
sudo vim /etc/td-agent/td-agent.conf
<match {tagname}>
@type stdout
</match>
fluentd起動
sudo /etc/init.d/td-agent start
goで使用
go get "github.com/t-k/fluent-logger-golang/fluent"
f, _ := fluent.New(fluent.Config{})
f.Post("debug.test", map[string]string{"message": "hello"})
f.PostWithTime("reply", time.Now(), map[string]interface{}{"data": "hello"})
output /var/log/td-agent/td-agent.log
2017-06-29 05:56:20 +0200 debug.test: {"message":"hello"}
2017-06-29 05:56:20 +0200 reply: {"data":"hello"}