class LogStash::Filters::Example

This example filter will replace the contents of the default message field with whatever you specify in the configuration.

It is only intended to be used as an example.

Public Instance Methods

filter(event) click to toggle source
# File lib/logstash/filters/example.rb, line 32
def filter(event)

  if @message
    # Replace the event message with our message as configured in the
    # config file.

    # using the event.set API
    event.set("message", @message)
    # correct debugging log statement for reference
    # using the event.get API
    @logger.debug? && @logger.debug("Message is now: #{event.get("message")}")
  end

  # filter_matched should go in the last line of our successful code
  filter_matched(event)
end
register() click to toggle source
# File lib/logstash/filters/example.rb, line 27
def register
  # Add instance variables
end