Skip to content

Instantly share code, notes, and snippets.

@nikushi
Last active August 29, 2015 13:58
Show Gist options
  • Save nikushi/9967127 to your computer and use it in GitHub Desktop.
Save nikushi/9967127 to your computer and use it in GitHub Desktop.
FluentdをHTTP経由でコンフィグロードして起動させるワンライナーhack

FluentdをHTTP経由でコンフィグロードして起動させるワンライナーhack

fluentd -i "include http://localhost:3000/fluentd.conf" -c /dev/null 

or

curl -s -S http://localhost:3000/fluentd.conf | fluentd -i - -c /dev/null 

前者の方法は-HUP送っても再読み込みしてくれる。 後者の方法だと-HUP送るとcurl経由のconfigが消えるので注意。

fluentd 0.10.42

@nikushi
Copy link
Author

nikushi commented Apr 4, 2014

webサーバが落ちてたらどうなるの?

fluentd -i "include http://localhost:3000/fluentd.conf" -c /dev/null 

で起動させた後、Webサーバを落としてfluentdにHUPを送ってたらfluentdはerror吐いて落ちたので、最悪プロセス監視とかログ監視で気づける。


2014-04-04 14:06:03 +0900 [info]: restarting
2014-04-04 14:06:03 +0900 [info]: shutting down fluentd
2014-04-04 14:06:04 +0900 [info]: process finished code=0
2014-04-04 14:06:04 +0900 [error]: fluentd main process died unexpectedly. restarting.
2014-04-04 14:06:04 +0900 [info]: starting fluentd-0.10.42
2014-04-04 14:06:04 +0900 [info]: reading config file path="/dev/null"
2014-04-04 14:06:04 +0900 [error]: config error file="/dev/null" error="include error at null line 2: Connection refused - connect(2) for \"localhost\" port 3000"
2014-04-04 14:06:04 +0900 [info]: process finished code=256
2014-04-04 14:06:04 +0900 [warn]: process died within 1 second. exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment