title: Converting date MMM dd HH:mm:ss for logstash
body: <p>I have a logfile with a custom format, the date field looks like this:</p>
  
  <pre><code>Dec  4 23:59:21
  Nov 21 23:59:21
  </code></pre>
  
  <p>in my logstash config I have this for the filter:</p>
  
  <pre><code>date {
      type =&gt; "custom"
      # tell it the format
      custom_timestamp =&gt; ["MMM  d HH:mm:ss", "MMM dd HH:mm:ss"]
      # locale didn't help
      locale =&gt; "en"
  }
  mutate{
      type =&gt; "custom"
      # replace the timestamp
      replace =&gt; ["@timestamp", "%{custom_timestamp}"]
  }
  </code></pre>
  
  <p>which supposedly replaces the logstash timestamp with the custom one from the logs (I am backfilling it from old logs at the moment to test).</p>
  
  <p>If I turn on the debug flag and output to stdout, it shows me that <code>@timestamp</code> has been replaced with <code>custom_timestamp</code> but I get an error message telling me that it cannot be imported:</p>
  
  <pre><code>:exception=&gt;java.lang.IllegalArgumentException: Invalid format: "Dec  4 23:59:21"
  </code></pre>
  
  <p>what do I have to do to convert the date format?</p>