# Date AM/PM format - Logstash filter date parse error

**URL:** https://discuss.elastic.co/t/date-am-pm-format-logstash-filter-date-parse-error/59856
**Category:** Logstash
**Created:** [September 6, 2016, 9:04am UTC](https://discuss.elastic.co/t/date-am-pm-format-logstash-filter-date-parse-error/59856 "2016-09-06T09:04:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hongguan\_chuah](https://avatars.discourse-cdn.com/v4/letter/h/f05b48/32.png) [@hongguan\_chuah](https://discuss.elastic.co/u/hongguan_chuah)
#### Post date: [September 6, 2016, 9:04am UTC](https://discuss.elastic.co/t/date-am-pm-format-logstash-filter-date-parse-error/59856/1 "2016-09-06T09:04:27Z")

</div>

I am having trouble on getting the filter date pattern match with my log file date pattern.  
I want the date appears as EventDateTime attribute and date would be removed inside message field.  
Anyone can help me, having trouble with setting up date with am/pm format.  
Thanks.

my log file date format : 9/6/2016 3:46:01 AM

Below is my filter inside my config file

> ```
> filter {
> grok {
> match => { "message" => "^(?<EventDateTime>%{MONTHNUM}/%{MONTHDAY}/%{YEAR} %{TIME}(?:AM|am|PM|pm))%{GREEDYDATA}" }
> }
> date {
> match => ["EventDateTime", "dd/MM/YYYY hh:mm:ss a"]
> #timezone => "UTC"
> #remove_field => ["EventDateTime"]
> }
> }
> 
> ```

Error Message

Pipeline main started  
←[33mFailed parsing date from field {:field=\>"EventDateTime", :value=\>"9/6/2016  
3:46:01", :exception=\>"Invalid format: "9/6/2016 3:46:01" is too short", :conf  
ig\_parsers=\>"dd/MM/YYYY hh:mm:ssa", :config\_locale=\>"default=en\_US", :level=\>:wa  
rn}←[0m

> ```
> {
> "message" => "9/6/2016 3:49:01 PM:Sending : FREE\r",
> "@version" => "1",
> "@timestamp" => "2016-09-06T09:43:52.052Z",
> "path" => "c:/logstash-tutorial/test1.trc",
> "host" => "test1",
> "tags" => [
> [0] "_grokparsefailure"
> ]
> }
> 
> ```

---

<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, 4:39am UTC](https://discuss.elastic.co/t/date-am-pm-format-logstash-filter-date-parse-error/59856/2 "2017-07-06T04:39:33Z")

</div>


