class InHostNameAdder
Public Instance Methods
parse_line(line)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_host_name_adder.rb, line 7 def parse_line(line) super internal_ip_address_or_hostname + line end
Private Instance Methods
internal_ip_address_or_hostname()
click to toggle source
# File lib/fluent/plugin/in_host_name_adder.rb, line 13 def internal_ip_address_or_hostname hostname = Socket.gethostbyname(ENV["HOSTNAME"]) # "internalIpAddr:#{hostent[3].unpack("C4").join('.')}\t" "#{hostent[3].unpack("C4").join('.')}\t" rescue => e hostname = ENV["HOSTNAME"] || `hostname`.chomp # "hostname:#{hostname}\t" "#{hostname}\t" end