LoginSignup
6

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)

だと安心

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