[Solved]Logstash 1.5.0 could not get host field

Here is rubydebug on logstash 1.5.0:

{
     "@timestamp" => "2015-06-11T06:29:51.220Z",
        "message" => "2015-06-11 14:29:50,565 [vert.x-eventloop-thread-1] DEBUG hawkeyes.rtds.store.domain.Equipment  - Packages arrived: 334",
       "@version" => "1",
           "type" => "rtds",
           "tags" => [
        [0] "rtds_log",
        [1] "vertx"
    ],
           "host" => "localhost.localdomain",
           "path" => "/var/log/rtds/rtds.log",
           "date" => "2015-06-11T06:29:50.565Z",
    "thread_name" => "vert.x-eventloop-thread-1",
      "log_level" => "DEBUG",
       "verticle" => "hawkeyes.rtds.store.domain.Equipment",
        "content" => "Packages arrived: 334"
}

host field is localhost.localdomain. This is not correct. Logstash 1.4.2 works very well, it can get the right hostname.

# hostname
edmac

# cat /etc/hostname
edmac

What does hostname -f on the CLI return.

It returns localhost.localdomain. How to return hostname string?

The hostname command can be used to set the machine's hostname, but I think your problem is that your /etc/hosts file maps your IP address to localhost.localdomain.

Yes, you're right.

/etc/hosts before:

127.0.0.1 localhost
127.0.1.1	localhost.localdomain	localhost shyq edmac

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback shyq
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.162.96.170 AY140703160223302b59Z

after:

127.0.0.1 edmac
127.0.0.1 localhost
127.0.1.1	localhost.localdomain	localhost shyq

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback shyq
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.162.96.170 AY140703160223302b59Z

Move edmac to the first line, and hostname -f returns edmac. Solved this problem.
Thanks.