# Field not converting to integer

**URL:** <https://discuss.elastic.co/t/field-not-converting-to-integer/78004>\
**Category:** Logstash\
**Created:** [March 9, 2017, 3:09pm UTC](https://discuss.elastic.co/t/field-not-converting-to-integer/78004 "2017-03-09T15:09:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pokecallum](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@Pokecallum](https://discuss.elastic.co/u/Pokecallum)\
**Post date:** [March 9, 2017, 3:09pm UTC](https://discuss.elastic.co/t/field-not-converting-to-integer/78004/1 "2017-03-09T15:09:10Z")

</div>

Hi,

Can anyone see why my hour field isnt converting to an integer. But my size field is. Im not getting any obvious errors anywhere to explain why

```
input {
    file {
        type => "csv"
        path => "/home/callum/Desktop/test2/*.csv"
        start_position => beginning
        sincedb_path => "/dev/null"
    }
}
filter {
        csv {
            separator => ","       
            columns => ["Date","User","Size","File Type","Device Class","Device Model","File Name","Time"]
        }

        date {
            match => ["Date", "yyyy-MM-dd'T'HH:mm:ssZZ"]

        }
        mutate {
            rename => {"Date" => "Time"}
            add_field => {"hour" => "%{+HH}"}
            convert => { "hour" => "integer" }
            convert => { "Size" => "integer" }
            remove_field => ["message","path","host","type"]
            lowercase => ["Date","User","Size","File Type","Device Class","Device Model","File Name"]
        }
        
}
    output {
            elasticsearch {
                hosts => "http://localhost:9200"
                index => "b"

            }
stdout { codec => rubydebug }
    }

```

> "User" =\> "callum",  
> "Size" =\> 61751,  
> "File Type" =\> "xlsx",  
> "Time" =\> "2017-02-25T13:19:03Z",  
> "@timestamp" =\> 2017-02-25T13:19:03.000Z,  
> "Device Class" =\> "removable",  
> "Device Model" =\> "sandisk cruzer blade usb device, disk drive, (standard disk drives)",  
> "hour" =\> "13",  
> "@version" =\> "1",  
> "File Name" =\> "j:my spreadsheet.xlsx"

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 9, 2017, 3:13pm UTC](https://discuss.elastic.co/t/field-not-converting-to-integer/78004/2 "2017-03-09T15:13:59Z")

</div>

The options given to the mutate filter aren't executed in the order given. If you require a particular order you need to use multiple consecutive mutate filters.

> <https://github.com/logstash-plugins/logstash-filter-mutate/issues/28>

---

<div class="post-metadata">

**Author:** ![Pokecallum](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@Pokecallum](https://discuss.elastic.co/u/Pokecallum)\
**Post date:** [March 9, 2017, 3:25pm UTC](https://discuss.elastic.co/t/field-not-converting-to-integer/78004/3 "2017-03-09T15:25:09Z")

</div>

Cheers !!

---

<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:** [April 6, 2017, 3:25pm UTC](https://discuss.elastic.co/t/field-not-converting-to-integer/78004/4 "2017-04-06T15:25:24Z")

</div>

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