# Nxlog and elasticsearch

**URL:** https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541
**Category:** Elasticsearch
**Created:** [April 6, 2016, 2:04pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541 "2016-04-06T14:04:06Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![zen.xen](https://avatars.discourse-cdn.com/v4/letter/z/e495f1/32.png) [@zen.xen](https://discuss.elastic.co/u/zen.xen)
#### Post date: [April 6, 2016, 2:04pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/1 "2016-04-06T14:04:06Z")

</div>

Hello,  
to send logs I use winlogbeat and it works, but I want to try to send logs from Windows machine to ELK installed on Windows with nxlog and it doesn't work, here is my nxlog.conf, maybe someone will correct it,

```
define ROOT C:\Program Files (x86)\nxlog

Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log

<Extension json> 
    Module xm_json 
</Extension> 

<Input in>
    Module im_msvistalog
    Exec to_json();
</Input>

<Output elasticsearch> 
    Module om_http 
    URL http://192.168.11.105:9200 
    ContentType application/json 
    Exec set_http_request_path(strftime($EventTime, "/logstash-%Y.%m.%d/" + $SourceModuleName)); rename_field("timestamp","@timestamp"); to_json();         
</Output> 

<Route 1>
    Path in => elasticsearch
</Route>
```

---

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [April 6, 2016, 4:35pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/2 "2016-04-06T16:35:48Z")

</div>

Are you using nxlog Enterprise edition? Only the enterprise editon supports direct output from nxlog to ES via the elasticsearch module. I doubt that you can use `om_http` as a work around to post data to ES via HTTP

---

<div class="post-metadata">

### Author: ![zen.xen](https://avatars.discourse-cdn.com/v4/letter/z/e495f1/32.png) [@zen.xen](https://discuss.elastic.co/u/zen.xen)
#### Post date: [April 6, 2016, 4:54pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/3 "2016-04-06T16:54:57Z")

</div>

no, I use Community Edition, in EE there was used module `om_elasticsearch`. Maybe you know other - let say - solution, I'm looking for a solution but until now I haven't found.  
In the Internet there are a lot of examples of nxlog.conf but none of them is useful for me. I wanted use nxlog, there is a possibility to exclude some events from sending to log server.

---

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [April 6, 2016, 5:00pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/4 "2016-04-06T17:00:03Z")

</div>

You can use this model nxlog \> Logstash \> Elasticsearch. nxlog output data via om\_tcp. A sample config I'm using is as below:

**nxlog.conf**

```auto
<Output out_logstash>  
    Module om_tcp
    Host 192.168.0.10
    Port 5544
    OutputType LineBased
</Output>

```

You need to have Logstash installed and listen on tpc port 5544 (or any other port)

**logstash.conf**

```auto
input {

	# Receive from nxlog
	tcp {
		port => 5544
		type => "test"
	} 
}

filter {
	# Parse JSON fields from message field
	json {
		source => "message"
	}
	
	## Must be last filter!!! ##
	mutate {
		remove_field => ["message"]
	}	
}

output {	
	elasticsearch {
		hosts => ["192.168.0.10:9200"]     
		index => "test-index"
	}
}

```

You can have Logstash run on the same server as Elasticsearch.

---

<div class="post-metadata">

### Author: ![zen.xen](https://avatars.discourse-cdn.com/v4/letter/z/e495f1/32.png) [@zen.xen](https://discuss.elastic.co/u/zen.xen)
#### Post date: [April 6, 2016, 5:52pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/5 "2016-04-06T17:52:44Z")

</div>

I'm using ELK on Windows, which files on server should I change?

---

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [April 6, 2016, 7:42pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/6 "2016-04-06T19:42:03Z")

</div>

I've edited the previous post to include what files you need to change.

---

<div class="post-metadata">

### Author: ![zen.xen](https://avatars.discourse-cdn.com/v4/letter/z/e495f1/32.png) [@zen.xen](https://discuss.elastic.co/u/zen.xen)
#### Post date: [April 7, 2016, 10:32am UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/7 "2016-04-07T10:32:23Z")

</div>

I did like you suggested, created logstash.conf in ...\logstash\bin but I don't know if this file is read by logstash.  
logstash.conf should be initialized in some way?

In nxlog.log there is `ERROR couldn't connect to tcp socket on 192.168.11.105:5544; A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.`

192.168.11.105 is my ELK server

---

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [April 7, 2016, 3:32pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/8 "2016-04-07T15:32:18Z")

</div>

1. Run a `netstat -na | findstr 5544` on the ELK server to see if it is listening to TCP 5544
2. Check Windows Firewall or other firewall to see if it is blocking incoming traffic.

---

<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: [July 5, 2017, 11:01pm UTC](https://discuss.elastic.co/t/nxlog-and-elasticsearch/46541/9 "2017-07-05T23:01:27Z")

</div>


