# Nxlog not adding hostname

**URL:** https://community.graylog.org/t/nxlog-not-adding-hostname/2385
**Category:** Graylog Central (peer support)
**Created:** [September 8, 2017, 4:34pm UTC](https://community.graylog.org/t/nxlog-not-adding-hostname/2385 "2017-09-08T16:34:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Marsel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@Marsel](https://community.graylog.org/u/Marsel)
#### Post date: [September 8, 2017, 4:34pm UTC](https://community.graylog.org/t/nxlog-not-adding-hostname/2385/1 "2017-09-08T16:34:10Z")

</div>

Hi,

I have a simple output configured in nxlog config file to forward logs from a .log file running on windows 7. I can’t seem to be able to forward the hostname in the log. Graylog will use the IP address from the load balancer as the source. I have tried all of the following options:

```auto
<Output out_orpos>
  Module om_udp
  Host graylog.test.com
  Port 12211
  Exec $hostname = hostname();
  Exec $Hostname = '<ServerHostname>';
  Exec $hostname = hostname_fqdn(); 
  Exec $source = 'lab'; 
  Exec $SourceName = 'lab';
</Output>

```

The only option i have so far is to not NAT on the load balancer. Graylog will see the real host IP.  
Thank you

---

<div class="post-metadata">

### Author: ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)
#### Post date: [September 8, 2017, 8:57pm UTC](https://community.graylog.org/t/nxlog-not-adding-hostname/2385/2 "2017-09-08T20:57:25Z")

</div>

What type of input are you using to receive these messages?

Your configuration doesn’t look like you’re emitting GELF (which would have the capability to set the hostname).  
See [https://nxlog.co/docs/nxlog-ce/nxlog-reference-manual.html#xm\_gelf](https://nxlog.co/docs/nxlog-ce/nxlog-reference-manual.html#xm_gelf) for further details.

---

<div class="post-metadata">

### Author: ![Marsel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@Marsel](https://community.graylog.org/u/Marsel)
#### Post date: [September 8, 2017, 9:06pm UTC](https://community.graylog.org/t/nxlog-not-adding-hostname/2385/3 "2017-09-08T21:06:44Z")

</div>

I am using raw/plaintext UDP input. With GELF i was getting the following errors.

com.fasterxml.jackson.core.JsonParseException: Unrecognized token ‘oracle’: was expecting (‘true’, ‘false’ or ‘null’)

Thank you for your response.

---

<div class="post-metadata">

### Author: ![Marsel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@Marsel](https://community.graylog.org/u/Marsel)
#### Post date: [September 8, 2017, 10:50pm UTC](https://community.graylog.org/t/nxlog-not-adding-hostname/2385/4 "2017-09-08T22:50:39Z")

</div>

> [@Marsel](#):
>
> GELF

I added GELF as output in nxlog.conf but have syslog as the configured input in graylog, and i think it is working now.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)
#### Post date: [September 22, 2017, 10:50pm UTC](https://community.graylog.org/t/nxlog-not-adding-hostname/2385/5 "2017-09-22T22:50:44Z")

</div>

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