Closed artyrcheek closed 11 months ago
Hi @artyrcheek,
Thank you for raising this!
Could you share what Ruby and Rails versions are you using? 🙏
Are you using a latest version of logtail-rails
gem?
This info should help us reproduce the issue faster.
I'm passing this on to the team to take a look soon. I'll make sure to keep you updated here on GitHub.
Thanks again for reaching out.
Tool | Version |
---|---|
Ruby | 3.1.2 |
Rails | 7.1 |
logtail-rails | 0.2.6 |
logtail-rack | 0.2.4 |
logtail | 0.1.12 |
Hello @artyrcheek and thanks for reporting the issue.
I've tried to reproduce the problem, but I was unsuccessful - the feature behaved as expected.
I've modified the example project according to your description, my config/application.rb
looks like this:
require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module ExampleProject
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
config.logtail.filter_sent_to_better_stack do |log_entry|
# Filter out logs from the /up endpoint
log_entry.context_snapshot[:http][:path] == "/up"
end
config.logger = Logtail::Logger.create_default_logger("YhLX...REDACTED...hjeu")
end
end
Then, I installed dependencies via bundle install
, started server via PORT=3420 rails server
and visited pages 127.0.0.1:3420/
, 127.0.0.1:3420/up
, and 127.0.0.1:3420/down
.
My Live Tail then looks like this (notice the /up
request missing):
I even made sure to use the same dependencies:
Tool | Version |
---|---|
Ruby | 3.1.2 |
Rails | 7.1.1 |
logtail-rails | 0.2.6 |
logtail-rack | 0.2.4 |
logtail | 0.1.12 |
Could you please take a look and see whether you'd modified the config/application.rb
similarly as above?
Do you see any errors in your app logs?
Could you please make a screenshot of the logs in Live Tail you're trying to filter out? With expanded JSON similar to the screenshot above? 🙏 My thinking is that you might not have active HTTP context, fields are differently named, or the endpoint contains a directory (such as /check/up
).
Could you maybe retry your setup in the example project?
Thanks for further details! 🙌
Hello @artyrcheek, hope my message helped you get it working 🙂
Feel free to reopen the issue with further details if the issue persist for you. 🙏
I am trying to filter out logs for our
/up
endpoint by following these docsIt doesn't seem to be working 🤔 The docs say "see
Logtail::LogEntry
for available attributes of the block parameter." The only method I see on theLogtail::LogEntry
class isto_hash
, should I be checking the HTTP path with to_hash instead?Am I missing anything?