# Unable to convert string/text fields to integer

**URL:** https://discuss.elastic.co/t/unable-to-convert-string-text-fields-to-integer/258788
**Category:** Logstash
**Created:** [December 15, 2020, 10:25pm UTC](https://discuss.elastic.co/t/unable-to-convert-string-text-fields-to-integer/258788 "2020-12-15T22:25:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mauro\_Tridici](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauro_tridici/32/78287_2.png) [@Mauro\_Tridici](https://discuss.elastic.co/u/Mauro_Tridici)
#### Post date: [December 15, 2020, 10:25pm UTC](https://discuss.elastic.co/t/unable-to-convert-string-text-fields-to-integer/258788/1 "2020-12-15T22:25:17Z")

</div>

Dear All,

two days ago I started using "Logstash exec plugin" to launch a bash script and save provided information in elasticsearch.  
At this moment, it seems working as expected, but I'm not able to convert "quota" and "used\_quota" fields in integer numbers.  
Using Kibana dashboard I can see "int", "int\_\_2", "int\_\_3" and file\_size as integer, but "quota" and "used\_quota" are still considered as "text" fields.  
I deleted and recreated the index, I refreshed it, but nothing changed.

Could you please help me to solve this issue?  
You can find below my logstash config file and a screenshot of kibana discover page.

Thank you,  
Mauro

` input {  
rabbitmq {  
tags =\> "1"  
id =\> "1"  
host =\> "localhost"  
queue =\> "audit\_messages"  
}  
exec {  
tags =\> "2"  
id =\> "2"  
codec =\> line  
command =\> "/usr/bin/iquotareport"  
interval =\> 15  
}  
}

filter {

if "1" in [tags] {  
if "\_jsonparsefailure" in [tags] {  
mutate {  
gsub =\> ["message", "[\]","" ]  
gsub =\> ["message", ".\ ***BEGIN\_JSON**", ""]  
gsub =\> ["message", " **END\_JSON**", ""]  
}  
mutate { remove\_tag =\> ["tags", "\_jsonparsefailure"] }  
json { source =\> "message" }  
}  
# Parse the JSON message  
json {  
source =\> "message"  
remove\_field =\> ["message"]  
}  
# Replace @timestamp with the timestamp stored in time\_stamp  
date {  
match =\> ["time\_stamp", "UNIX\_MS"]  
}  
# Convert select fields to integer  
mutate {  
convert =\> { "int" =\> "integer" }  
convert =\> { "int\_\_2" =\> "integer" }  
convert =\> { "int\_\_3" =\> "integer" }  
convert =\> { "file\_size" =\> "integer" }  
}

}

if "2" in [tags] {  
dissect {  
mapping =\> { "message" =\> "%{irods\_user},%{quota},%{used\_quota}" }  
}  
# Convert select fields to integer  
mutate {  
convert =\> { "quota" =\> "integer" }  
convert =\> { "used\_quota" =\> "integer" }  
}

}

}

output {  
# Write the output to elastic search under the irods\_audit index.  
elasticsearch {  
hosts =\> ["localhost:9200"]  
index =\> "irods\_audit"  
}  
} `

 ![Screenshot 2020-12-15 at 23.19.00](https://us1.discourse-cdn.com/elastic/original/3X/4/7/47b3d8b3d95ed704675135dfb6c3ae97217af838.png)

---

<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: [January 12, 2021, 10:25pm UTC](https://discuss.elastic.co/t/unable-to-convert-string-text-fields-to-integer/258788/2 "2021-01-12T22:25:23Z")

</div>

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