29
29

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.

pythonからfluentdを使う

Posted at

fluentdはinstallされた状態を前提
(参考) http://qiita.com/items/c89b53301a540be72744

ライブラリをinstall

pip install fluent-logger

configを修正

<source>
  type forward
  port 24224
</source>
<match fluent.test.**>
  type stdout
</match>

起動

fluentd -c ./fluent/fluent.conf -vv &

python script

#! /usr/local/bin/python
# -*- coding:utf-8 -*-

from fluent import sender
from fluent import event

# params -> *(tag, host, port)
sender.setup('fluent.test', host='localhost', port=24224)
event.Event('follow', {
    'from': 'userA',
    'to': 'userB'
    })

実行すると

2013-03-20 11:44:07 +0900 fluent.test.follow: {"to":"userB","from":"userA"}

と出力

29
29
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
29
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?