# Geoip.asn type conversion/checking to integer occasionaly failing in logstash

**URL:** <https://discuss.elastic.co/t/geoip-asn-type-conversion-checking-to-integer-occasionaly-failing-in-logstash/155711>\
**Category:** Logstash\
**Created:** [November 7, 2018, 12:21pm UTC](https://discuss.elastic.co/t/geoip-asn-type-conversion-checking-to-integer-occasionaly-failing-in-logstash/155711 "2018-11-07T12:21:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)\
**Post date:** [November 7, 2018, 12:21pm UTC](https://discuss.elastic.co/t/geoip-asn-type-conversion-checking-to-integer-occasionaly-failing-in-logstash/155711/1 "2018-11-07T12:21:56Z")

</div>

Trying to parse and use in another field the `geoip.asn` value as follows:

```auto
   geoip {
    default_database_type => "ASN"
    source => "dst"
   }

   mutate {
    add_field => ["[dst_asn]", "%{geoip.asn}" ]
    # remove_field => ["geoip"]
   }

```

Here is my respective index template field declaration:

`"dst_asn": {"type": "integer"},`

However, for **some** values I get the following error:

`[2018-11-07T14:19:17,716][WARN][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"my_index_raw_data-2018.11.07", :_type=>"_doc", :_routing=>nil}, #<LogStash::Event:0x5c30a50a>], :response=>{"index"=>{"_index"=>"my_index_raw_data-2018.11.07", "_type"=>"_doc", "_id"=>"Kcsc7mYBo99I6PWl0CVS", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [dst_asn]", "caused_by"=>{"type"=>"number_format_exception", "reason"=>"For input string: \"%{[geoip][asn]}\""}}}}}`

---

<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 5, 2018, 12:27pm UTC](https://discuss.elastic.co/t/geoip-asn-type-conversion-checking-to-integer-occasionaly-failing-in-logstash/155711/2 "2018-12-05T12:27:28Z")

</div>

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