# COMBINEDAPACHELOG grok definition creating all fields as type string

**URL:** <https://discuss.elastic.co/t/combinedapachelog-grok-definition-creating-all-fields-as-type-string/70630>\
**Category:** Logstash\
**Created:** [January 5, 2017, 3:01am UTC](https://discuss.elastic.co/t/combinedapachelog-grok-definition-creating-all-fields-as-type-string/70630 "2017-01-05T03:01:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hp-adl](https://avatars.discourse-cdn.com/v4/letter/h/ebca7d/32.png) [@hp-adl](https://discuss.elastic.co/u/hp-adl)\
**Post date:** [January 5, 2017, 3:01am UTC](https://discuss.elastic.co/t/combinedapachelog-grok-definition-creating-all-fields-as-type-string/70630/1 "2017-01-05T03:01:11Z")

</div>

Hi all,

I'm using the %{COMBINEDAPACHELOG} grok pattern for my Apache logs and parsing to Elasticsearch service (v2.3) in AWS and all the fields are created as string type. I have tried a number of custom patterns and I'm still having the same issue. I also have a custom IIS grok pattern running and it's working fine.

Here's my grok definition:

```
filter {
  if [type] == "apache-access" {
    grok {
        match => { "message" => "%{COMBINEDAPACHELOG}"}
    }

    geoip {
        source => "clientip"
    }
  }

output {
  if [type] == "apache-access" {
elasticsearch {
  hosts => ["my-elasticsearch-url:80"]
  index => "apache-%{+YYYY.MM.dd}"
  manage_template => false
}
  }
 stdout {codec => rubydebug}
}

```

Here's my elasticsearch index/mapping:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/7/77495f623db555c7c6febf9fe0e03e87ddb2bb3e.png)

Has anyone had the same experience? Any feedback, input or help would be much appreciated!

---

<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:** [January 6, 2017, 7:00pm UTC](https://discuss.elastic.co/t/combinedapachelog-grok-definition-creating-all-fields-as-type-string/70630/2 "2017-01-06T19:00:08Z")

</div>

Yes, this is arguably a bug in the grok pattern(s). You should use a mutate filter's convert option to convert e.g. the `bytes` field to an integer. This issue is relevant:

> <https://github.com/logstash-plugins/logstash-patterns-core/issues/173>

---

<div class="post-metadata">

**Author:** ![hp-adl](https://avatars.discourse-cdn.com/v4/letter/h/ebca7d/32.png) [@hp-adl](https://discuss.elastic.co/u/hp-adl)\
**Post date:** [January 9, 2017, 3:49am UTC](https://discuss.elastic.co/t/combinedapachelog-grok-definition-creating-all-fields-as-type-string/70630/3 "2017-01-09T03:49:43Z")

</div>

Thanks Magnus, I've created a mutate filter and converted the relevant fields to integer and float and it now works.

---

<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:** [February 6, 2017, 3:49am UTC](https://discuss.elastic.co/t/combinedapachelog-grok-definition-creating-all-fields-as-type-string/70630/4 "2017-02-06T03:49:52Z")

</div>

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