# Logstash/ long datatype returning String

**URL:** <https://discuss.elastic.co/t/logstash-long-datatype-returning-string/151789>\
**Category:** Elasticsearch\
**Created:** [October 10, 2018, 8:23am UTC](https://discuss.elastic.co/t/logstash-long-datatype-returning-string/151789 "2018-10-10T08:23:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lakshmi\_Deepak\_Katar](https://avatars.discourse-cdn.com/v4/letter/l/85e7bf/32.png) [@Lakshmi\_Deepak\_Katar](https://discuss.elastic.co/u/Lakshmi_Deepak_Katar)\
**Post date:** [October 10, 2018, 8:23am UTC](https://discuss.elastic.co/t/logstash-long-datatype-returning-string/151789/1 "2018-10-10T08:23:09Z")

</div>

Hi,

Please help me, I am very new to ELK, I am trying to change file-size field value to long data type but it is returning as string.

log message:  
19-09-2018 18:25:12.676 type:interface::filename:AccountsDetails.csv::recordcount:2::region:IND::file\_size:40::recieved\_time:15-09-2018 16:21:u5408:

Grok Pattern:  
%{DATESTAMP:Timestamp} %{WORD:app}:%{WORD:interface}::%{WORD:comp}:%{DATA:filename}::%{WORD:recordcount}:%{INT:record\_count:int}::%{WORD:region}:%{DATA:region\_name}::%{WORD:filesize}:%{INT:file-size:long}::%{WORD:time}:%{DATESTAMP:TransferTime}

---

<div class="post-metadata">

**Author:** ![jakelandis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakelandis/32/36163_2.png) [@jakelandis](https://discuss.elastic.co/u/jakelandis)\
**Post date:** [October 11, 2018, 7:00am UTC](https://discuss.elastic.co/t/logstash-long-datatype-returning-string/151789/2 "2018-10-11T07:00:57Z")

</div>

Assuming this grok defined in Logstash, you will want to use `%{INT:file-size:int}`. I wouldn't worry about integer overflow in Logstash since it is based in Ruby and it will auto convert excessively large numbers to a BigNum.

With Elasticsearch, if you are using dynamic mapping for this field, it will just work since it will be [backed by a long](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html). However, if you explicitly map this field be sure to use a long data type.

If this is grok via the ingest node, what you have should work.

---

<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:** [November 8, 2018, 7:01am UTC](https://discuss.elastic.co/t/logstash-long-datatype-returning-string/151789/3 "2018-11-08T07:01:01Z")

</div>

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