6
6

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ではまりどこ??

Last updated at Posted at 2013-09-30
from fluent import sender
from fluent import event

sender.setup("tag")
event.Event("label", data)

みたいにやってる記事が多かった。
違和感があったので実際に実装見てみるとグローバル変数使ってる!
(setupメソッドで_global_senderというグローバル変数を利用 -> Eventの__init__で_global_sender_.emit_with_nameをよびtimestampに現在の時間を渡している)

というわけで

from fluent import sender
import time

send = sender.FluentSender("tag", host="localhost", port=24224)
send.emit_with_time("label", int(time.time()), data)

だと安心

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?