# Logstash from winlogbeat to file not sorting results properly

**URL:** <https://discuss.elastic.co/t/logstash-from-winlogbeat-to-file-not-sorting-results-properly/209307>\
**Category:** Logstash\
**Created:** [November 25, 2019, 12:56pm UTC](https://discuss.elastic.co/t/logstash-from-winlogbeat-to-file-not-sorting-results-properly/209307 "2019-11-25T12:56:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saif3r](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@saif3r](https://discuss.elastic.co/u/saif3r)\
**Post date:** [November 25, 2019, 12:56pm UTC](https://discuss.elastic.co/t/logstash-from-winlogbeat-to-file-not-sorting-results-properly/209307/1 "2019-11-25T12:56:49Z")

</div>

Hello,

I'm extracting information from my winlogbeat index and sorting them by @timestamp. Unfortunately it seems like output file results are not properly sorted by that field. Any idea why?  
Note: I've run the pipeline once, using --pipeline.workers=1

Input:

```
input {
	elasticsearch {
		hosts => ["localhost:9200"]
		index => "winlogbeat*"
		query => '{
				  "query": {
					"bool": {
					  "must": [
						{
						  "terms": {
							"event.code": [
							  "4624",
							  "4634",
							  "4647"
							]
						  }
						}
					  ],
					  "filter": {
						"range": {
						  "@timestamp": {
							"gte": "now-250d"
						  }
						}
					  }
					}
				  },
				  "sort": {
					"@timestamp": {
					  "order": "asc"
					}
				  }
				}'
	}
}

```

Results:

> 2019-09-12T00:03:41.585Z|0x58322d370|account6|Logon  
> _2019-09-12T00:04:08.763Z|0x58339d631|account\_123|Logoff_  
> 2019-09-12T00:04:16.372Z|0x58322d370|account6|Logoff  
> **2019-09-12T00:04:38.762Z|0x58364edf4|account1|Logoff**  
> _2019-09-12T00:03:58.000Z|0x58339d631|account\_123|Logon_  
> 2019-09-12T00:04:10.844Z|0x5834bf2fa|account2|Logon  
> **2019-09-12T00:04:27.114Z|0x58364edf4|account1|Logon**  
> 2019-09-12T00:04:48.382Z|0x5834bf2fa|account2|Logoff  
> 2019-09-12T00:05:03.380Z|0x583971f91|account3|Logon  
> 2019-09-12T00:05:41.953Z|0x583971f91|account3|Logoff

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 25, 2019, 2:45pm UTC](https://discuss.elastic.co/t/logstash-from-winlogbeat-to-file-not-sorting-results-properly/209307/2 "2019-11-25T14:45:41Z")

</div>

If pipeline.java\_execution is enabled (and it is on by default in v7) then events are [re-ordered](https://github.com/elastic/logstash/issues/10938) even with "--pipeline.workers 1"

---

<div class="post-metadata">

**Author:** ![saif3r](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@saif3r](https://discuss.elastic.co/u/saif3r)\
**Post date:** [November 29, 2019, 2:33pm UTC](https://discuss.elastic.co/t/logstash-from-winlogbeat-to-file-not-sorting-results-properly/209307/3 "2019-11-29T14:33:29Z")

</div>

Hi,

Seems like with this entry it works just fine:

```
  pipeline.java_execution: false

```

Thanks.

---

<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 27, 2019, 2:33pm UTC](https://discuss.elastic.co/t/logstash-from-winlogbeat-to-file-not-sorting-results-properly/209307/4 "2019-12-27T14:33:44Z")

</div>

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