Ruby on Rails Tuesday, August 14, 2018

Can anybody provide some links to how to set up correctly Lograge, logstash-logger with a Rails API app ? I followed their READMEs but still nothing sent to Kibana :(.

Here is how these gems are declared in Gemfile:

group :development do

  gem
'lograge',         '~> 0.10.0'
  gem
'logstash-event',  '~> 1.2'
  gem
'logstash-logger', '~> 0.26.1'
end


I added the following lines in  config/environments/development.rb:

config.lograge.enabled = true
  config
.lograge.base_controller_class = 'ActionController::API'
  config
.lograge.formatter = Lograge::Formatters::Logstash.new
 
#config.lograge.logger = LogStashLogger.new(uri: ENV['logstash_uri'], verify_hostname: false)
  config
.lograge.logger = LogStashLogger.new(host: ENV['logstash_host'], port: ENV['logstash_port'], verify_hostname: false)
  config
.lograge.custom_options = lambda do |event|
   
{ name: "decastore-development" }
 
end


As you see, I tried 2 different ways to initialize LogStashLogger, but still without success.
What's wrong with that ? 
I'm using Rails 5.2.0 (API only), ruby 2.5.0.

Thank you

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a5eb2cc1-ed2d-400a-b50a-2f94b1c67001%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment