# Regarding Filebeat Offset Value

**URL:** https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139
**Category:** Beats
**Tags:** filebeat
**Created:** [March 11, 2016, 10:28am UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139 "2016-03-11T10:28:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![vivc](https://avatars.discourse-cdn.com/v4/letter/v/ce7236/32.png) [@vivc](https://discuss.elastic.co/u/vivc)
#### Post date: [March 11, 2016, 10:28am UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/1 "2016-03-11T10:28:24Z")

</div>

Regarding filebeat offset , The value of offset for the lines in the same log file is not shown in sequential order based on order of line numbers in the file.

I've some queries on the filebeat offset .

Is the offset the line offset or byte offset .  
Is there any way by which I can the get the line number of particular file on sequential order so that the lines can be sorted based on line number or offset.  
Can we reset the offset value to 0 so that the offset get incremented after reading each line of the file.

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [March 11, 2016, 2:49pm UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/2 "2016-03-11T14:49:42Z")

</div>

Offset is the number of bytes read. For more details on why there is no line number see here: [https://github.com/elastic/beats/issues/1037](https://github.com/elastic/beats/issues/1037)

As the offset is used for internal logic, there is no overwriting possible.

---

<div class="post-metadata">

### Author: ![vivc](https://avatars.discourse-cdn.com/v4/letter/v/ce7236/32.png) [@vivc](https://discuss.elastic.co/u/vivc)
#### Post date: [March 16, 2016, 3:55am UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/3 "2016-03-16T03:55:56Z")

</div>

Thanks for the information.

Could you please let me know if there is any field in filebeat or logstash based on which we can sort the lines in the a particular file.

Based on the line selected we should be able to filter number of lines above and below that line in the file.

---

<div class="post-metadata">

### Author: ![vivc](https://avatars.discourse-cdn.com/v4/letter/v/ce7236/32.png) [@vivc](https://discuss.elastic.co/u/vivc)
#### Post date: [March 17, 2016, 3:28pm UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/4 "2016-03-17T15:28:36Z")

</div>

Is there any field in filebeat which sequencially get incremented on reading of each line in a log file and reset it when the next file is read.

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [March 18, 2016, 8:39am UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/5 "2016-03-18T08:39:43Z")

</div>

I think what you are looking for is `offset`. You mentioned in the beginning that it is not necessarly the same order, but that shouldn't be. If that is the case, can you share some more details?

---

<div class="post-metadata">

### Author: ![iglxxx](https://avatars.discourse-cdn.com/v4/letter/i/5f9b8f/32.png) [@iglxxx](https://discuss.elastic.co/u/iglxxx)
#### Post date: [April 19, 2017, 1:42am UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/6 "2017-04-19T01:42:36Z")

</div>

in this case, can we filter by ip and file path.  
then order by timestamp and offset ?

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [April 21, 2017, 11:08am UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/7 "2017-04-21T11:08:03Z")

</div>

@iglxxx Probably i need some more details from you here. Can you open a new topic?

---

<div class="post-metadata">

### Author: ![iglxxx](https://avatars.discourse-cdn.com/v4/letter/i/5f9b8f/32.png) [@iglxxx](https://discuss.elastic.co/u/iglxxx)
#### Post date: [April 22, 2017, 4:14pm UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/8 "2017-04-22T16:14:54Z")

</div>

en. there is a case in our company. we use filebeat collect log file and send to elasticserch.  
we search something from elasticsearch, if we select one result, we want to see 10 lines above it and 10 lines before it according the order in the original log file.  
in the first time, we sort by timestamp ,but it does not work well, beacuse timestamp my be the same value.  
in the second time, we sort by offset only, but it has the same value.  
at the end, we sort by both timestamp and offset, it seems work well.  
but i find a pull in kibana can solve it.

> <https://github.com/elastic/kibana/pull/9198>

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [April 24, 2017, 7:21pm UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/9 "2017-04-24T19:21:39Z")

</div>

So the problem is solved for you? If not, please open a new topic as this one is already a year old. Closing the topic.

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [April 24, 2017, 7:21pm UTC](https://discuss.elastic.co/t/regarding-filebeat-offset-value/44139/10 "2017-04-24T19:21:47Z")

</div>


