Display hostname instead of

(Saeid) #1

Currently the "host" field in our logs always is "". We want it to be either the "hostname" or the actual ip of the current machine. How can I achieve that?

(Saeid) #2

Found the solution. The only way I could get it to work was by using ruby.
It's quite easy actually. Just add the following code as a filter:

filter {
  ruby {
    init => "require 'socket'"
    code => "event.set('host', Socket.gethostname)"

(system) closed #3

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