Skip to content

Commit

Permalink
Add the client IP address to each message if requested in the configu…
Browse files Browse the repository at this point in the history
…ration

file. Requires an update to the Lumberjack server to pass along the address.
  • Loading branch information
stanhu committed Jan 22, 2015
1 parent 891379d commit 0861c9d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/logstash/inputs/lumberjack.rb
Expand Up @@ -29,6 +29,9 @@ class LogStash::Inputs::Lumberjack < LogStash::Inputs::Base
# SSL key passphrase to use.
config :ssl_key_passphrase, :validate => :password

# The field name where the client IP address should be stored in each message
config :client_address_field, :validate => :string, :default => nil

# TODO(sissel): Add CA to authenticate clients with.

public
Expand All @@ -43,9 +46,12 @@ def register

public
def run(output_queue)
@lumberjack.run do |l|
@lumberjack.run do |l, client_address|
@codec.decode(l.delete("line")) do |event|
decorate(event)
if !@client_address_field.nil?
event[@client_address_field] = client_address
end
l.each { |k,v| event[k] = v; v.force_encoding(Encoding::UTF_8) }
output_queue << event
end
Expand Down

0 comments on commit 0861c9d

Please sign in to comment.