# Input-gelf-plugin wrong SOURCE\_HOST\_FIELD

**URL:** <https://discuss.elastic.co/t/input-gelf-plugin-wrong-source-host-field/157344>\
**Category:** Logstash\
**Created:** [November 19, 2018, 12:16pm UTC](https://discuss.elastic.co/t/input-gelf-plugin-wrong-source-host-field/157344 "2018-11-19T12:16:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aborche](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@aborche](https://discuss.elastic.co/u/aborche)\
**Post date:** [November 19, 2018, 12:16pm UTC](https://discuss.elastic.co/t/input-gelf-plugin-wrong-source-host-field/157344/1 "2018-11-19T12:16:45Z")

</div>

When gelf plugin receives a message, SOURCE\_HOST\_FIELD filled with logstash listen address, instead of connected client address. And all incoming log records contains "0.0.0.0" instead real client ip.  
Value for SOURCE\_HOST\_FIELD must be client.peeraddr[2] ?

logstash-plugins/logstash-input-gelf/lib/logstash/inputs)/gelf.rb

```
    begin # Create event
      event = LogStash::Event.new(jsonObj)
      **event.set(SOURCE_HOST_FIELD, host.force_encoding("UTF-8"))**
      if event.get("timestamp").is_a?(Numeric)
        event.set("timestamp", LogStash::Timestamp.at(event.get("timestamp")))
        event.remove("timestamp")
      end
      remap_gelf(event) if @remap
      strip_leading_underscore(event) if @strip_leading_underscore
      decorate(event)
      output_queue << event
    rescue => ex
      @logger.warn("Gelf (tcp): failed to create event from json object. Skipping: " + jsonObj.to_s, :exception => ex, :backtrace => ex.backtrace)
    end
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 17, 2018, 12:16pm UTC](https://discuss.elastic.co/t/input-gelf-plugin-wrong-source-host-field/157344/2 "2018-12-17T12:16:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
