I'm following this Fluentd post to setup a working version of Fluentd with Rails. My fluent-logger.yml
:
development:
fluent_host: "localhost"
fluent_port: 24224
tag: "foo"
messages_type: "string"
The application.rb
:
config.log_level = :info
config.logger = ActFluentLoggerRails::Logger.new
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Json.new
My td-agent.conf
directives looks like this:
<source>
type forward
port 24224
</source>
<match foo>
type stdout
</match>
When I start my rails server, I do not see any log messages getting piped to td-agent.log . I'm using the act-fluent-logger-rails gem.
However, when I use the fluent-logger gem in the rails console and execute these commands:
require 'fluent-logger'
Fluent::Logger::FluentLogger.open(nil, :host=>'localhost',:port=>24224)
Fluent::Logger.post("fluentd.test.follow",{"from"=>"A","to"=>"B"})
I'm able to see the STDOUT getting populated with the message I sent. Where am I going wrong here, with running it in the app? Any heads up on this would be great! TIA.
Perhaps your Rails app was an API. In that case you may have to set config.lograge.base_controller_class = 'ActionController::API'
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.