Module: Philiprehberger::LogFilter::Presets

Defined in:
lib/philiprehberger/log_filter/presets.rb

Overview

Factory methods that return pre-configured Filter instances for common log-noise scenarios.

Class Method Summary collapse

Class Method Details

.assetsFilter

Filter that drops static-asset request log lines.

Returns:

  • (Filter)

    a filter suppressing asset paths



18
19
20
# File 'lib/philiprehberger/log_filter/presets.rb', line 18

def self.assets
  Filter.new.drop(/\.(css|js|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|map)\b/i)
end

.botsFilter

Filter that drops bot/crawler request log lines.

Returns:

  • (Filter)

    a filter suppressing bot user-agents



25
26
27
# File 'lib/philiprehberger/log_filter/presets.rb', line 25

def self.bots
  Filter.new.drop(/bot|crawler|spider|slurp|googlebot|bingbot/i)
end

.health_checkFilter

Filter that drops health-check request log lines.

Returns:

  • (Filter)

    a filter suppressing health-check paths



11
12
13
# File 'lib/philiprehberger/log_filter/presets.rb', line 11

def self.health_check
  Filter.new.drop(%r{health_?check|/health|/ping|/ready|/alive}i)
end