# Struggling to specify field types

**URL:** https://discuss.elastic.co/t/struggling-to-specify-field-types/34964
**Category:** Kibana
**Created:** [November 18, 2015, 3:47pm UTC](https://discuss.elastic.co/t/struggling-to-specify-field-types/34964 "2015-11-18T15:47:09Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Grenage](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@Grenage](https://discuss.elastic.co/u/Grenage)
#### Post date: [November 18, 2015, 3:47pm UTC](https://discuss.elastic.co/t/struggling-to-specify-field-types/34964/1 "2015-11-18T15:47:09Z")

</div>

Hi everyone,

I've got a box running Kibana and Elasticsearch, with the information being handed across by fluentd rather than logstash. In hindsight I'd have picked Logstash, but the guide at the time covered fluentd. It's all working pretty well, and I've moved on to pushing Windows events through - which is where I'm struggling.

I'm using nxlog on the windows machines, and it's pushing the data directly to elasticsearch - unfortunately I cannot for love nor money get the date to be handled as a date, rather than a string. While beyond the scope of this forum (I assume), then nxlog output is:

```
URL http://192.0.0.10:9200
ContentType application/json
Exec set_http_request_path(strftime($EventTime, "/windowsevents-%Y.%m.%d/" + $SourceModuleName)); delete($EventReceivedTime); rename_field("timestamp","@timestamp"); to_json();

```

I create a new index with a pattern of _windowsevents_\*, but the _EventTime_ field is stated as a string, not a date - so I can't sort data by age. _@timestamp_ clearly isn't getting populated, as the _timestamp_ field isn#t being used. Has anyone used a similar setup? Is there a way to ask Elastic to treat a field as a date?

Apologies if I've missed out pertinent information - it's all a bit new to me.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [November 18, 2015, 10:33pm UTC](https://discuss.elastic.co/t/struggling-to-specify-field-types/34964/2 "2015-11-18T22:33:16Z")

</div>

You may not have any luck here due to this being an NXLog issue, but I know there are a few users of it so hopefully someone can answer you 🙂

---

<div class="post-metadata">

### Author: ![Grenage](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@Grenage](https://discuss.elastic.co/u/Grenage)
#### Post date: [November 19, 2015, 9:02am UTC](https://discuss.elastic.co/t/struggling-to-specify-field-types/34964/3 "2015-11-19T09:02:36Z")

</div>

Hi there,

Thank you; I suspected that might be the case, but I wasn't sure if there was a means of specifying the data type within elastic/kibana. I wasn't having much luck on the nxlog side. Cheers!

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [November 19, 2015, 9:56am UTC](https://discuss.elastic.co/t/struggling-to-specify-field-types/34964/4 "2015-11-19T09:56:01Z")

</div>

I am not familiar with fluentd, so do not know if it provides some type of default mapping like Logstash does or not. Check if you have any [index templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html?q=index%20templates) defined that would apply to the index these logs go into. If this is the case you should be able to modify the mapping for the timestamp field so that Elasticsearch maps it as a date.

If you do not have a template defined and rely on dynamic mapping, you can create an index template with a mapping and specify the [date formats Elasticsearch uses to identify date fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#date-detection).

---

<div class="post-metadata">

### Author: ![Grenage](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@Grenage](https://discuss.elastic.co/u/Grenage)
#### Post date: [November 19, 2015, 11:50am UTC](https://discuss.elastic.co/t/struggling-to-specify-field-types/34964/5 "2015-11-19T11:50:05Z")

</div>

Dear Christian,

You're a hero, thank you. Using the information you referenced, I displayed the templates in use by elasticsearch, and checked the JSON information in Kibana.

```
"nxlog":{
  "order":0,"template":"nxlog*","settings":{},"mappings":{
    "_default_":{
      "properties":{
        "EventTime":{"format":"YYYY-MM-dd HH:mm:ss","type":"date"}
      }
    }
  },
  "aliases":{}
  }
}

```

I was pushing the information in as "windowsevents", and using "windowsevents\*" as an index template. Obviously I got a bit confused when I was following some other information, and went rogue with the names. I changed the output to read "nxlog\*", and bingo! I get presented with "EventTime" as a Time-Field option.

Once again, I thank you!

---

<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: [July 6, 2017, 2:08pm UTC](https://discuss.elastic.co/t/struggling-to-specify-field-types/34964/6 "2017-07-06T14:08:46Z")

</div>


