# Mapping timestamp field from catalina logs to elasticsearch

**URL:** <https://discuss.elastic.co/t/mapping-timestamp-field-from-catalina-logs-to-elasticsearch/45770>\
**Category:** Elasticsearch\
**Created:** [March 30, 2016, 9:21am UTC](https://discuss.elastic.co/t/mapping-timestamp-field-from-catalina-logs-to-elasticsearch/45770 "2016-03-30T09:21:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aviral\_srivastava](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aviral_srivastava/32/98018_2.png) [@aviral\_srivastava](https://discuss.elastic.co/u/aviral_srivastava)\
**Post date:** [March 30, 2016, 9:21am UTC](https://discuss.elastic.co/t/mapping-timestamp-field-from-catalina-logs-to-elasticsearch/45770/1 "2016-03-30T09:21:17Z")

</div>

My Catalina logs contains timestamp in this format:-  
**Mar 23, 2016 11:33:14 AM** org.apache.catalina.core.AprLifecycleListener init

My goal is to create **Date Histogram** using **timestamp** field in kibana.  
**Since timestamp field is taken as string type by default in kibana. So, timestamp field was not visible when I selected Date Histogram** I tried to define the mapping as follows using **joda docs** :-

POST /catalina\_logs\_20160330  
{"settings":{"number\_of\_shards":1},"mappings":{"type1"  
:{"\_source":{"enabled":false},"properties":{  
"timestamp":{"type":"date","format":"MMM dd, YYYY hh:mm:ss"},"className":{"type":"string","index":"not\_analyzed"},  
"methodName":{"type":"string","index":"not\_analyzed"},  
"message":{"type":"string","index":"not\_analyzed"}  
}}  
}}

But what is the format for **AM** or **PM**???

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [March 30, 2016, 9:42am UTC](https://discuss.elastic.co/t/mapping-timestamp-field-from-catalina-logs-to-elasticsearch/45770/2 "2016-03-30T09:42:40Z")

</div>

Hi,

According to , [http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html](http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html), `"a"` might do the trick.

---

<div class="post-metadata">

**Author:** ![aviral\_srivastava](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aviral_srivastava/32/98018_2.png) [@aviral\_srivastava](https://discuss.elastic.co/u/aviral_srivastava)\
**Post date:** [March 30, 2016, 12:47pm UTC](https://discuss.elastic.co/t/mapping-timestamp-field-from-catalina-logs-to-elasticsearch/45770/3 "2016-03-30T12:47:07Z")

</div>

I tried your approach but I am getting **illegal agrument exception**.  
This is the format of timestamp in logs **Mar 23, 2016 11:33:14 AM**. Is there any online tool or any other way we can check that we have correctly specified the format.

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [March 30, 2016, 1:08pm UTC](https://discuss.elastic.co/t/mapping-timestamp-field-from-catalina-logs-to-elasticsearch/45770/4 "2016-03-30T13:08:35Z")

</div>

Can you add your exact mapping, the document you are trying to index and the error message you are seeing?

---

<div class="post-metadata">

**Author:** ![aviral\_srivastava](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aviral_srivastava/32/98018_2.png) [@aviral\_srivastava](https://discuss.elastic.co/u/aviral_srivastava)\
**Post date:** [April 1, 2016, 11:15am UTC](https://discuss.elastic.co/t/mapping-timestamp-field-from-catalina-logs-to-elasticsearch/45770/5 "2016-04-01T11:15:45Z")

</div>

I found an alternative solution to it , i.e., we can use **date filter** which maps timestamp from our catalina logs to **@timestamp** in kibana.  
While configuring index pattern in kibana we need to select the option.  
**Index contains time-based events**.

---

<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 5, 2017, 11:03pm UTC](https://discuss.elastic.co/t/mapping-timestamp-field-from-catalina-logs-to-elasticsearch/45770/6 "2017-07-05T23:03:19Z")

</div>


