title: How to format, yyyymmdd to yyyy-mm-dd in Logstash?
body: <p>I've started working around with the <code>ELK tool stack</code> since few weeks. What I need is to get the <code>timestamp</code> of the log event which includes date and the time and show it in a different field (ie: log_timestamp). I've tried pulling out all the options available for the DateStamp, but nothing worked.</p>
  
  <p>This is a line of the log file which I have: </p>
  
  <p>"<strong>20160805 00:00:01.296,GetProvisioning,3,W1oOOW8oj58GhglVjVNg0Ssl4CXA1P,50219--1958335734-1470326399706,SUCCESS,GetProvisioningTransactionId-01223,null,W1oOOW8oj58GhglVjVNg0Ssl4CXA1P,en,CELCOM_MY_DCB</strong>
  "</p>
  
  <p>I need to format the date of the log event as <code>yyyy-mm-dd</code>, since i'm unable to use the  "Date"  grok filters. Or is there a way that I can filter it out with the above <code>yyyymmdd</code> date format? </p>
  
  <p><strong>EDIT</strong>:
  I'm hereby attaching my customized pattern and the filter part of the <code>logstash conf</code>.</p>
  
  <p>pattern which I'm using: <strong>LOGTIMESTAMP %{YEAR}%{MONTHNUM}%{MONTHDAY}</strong></p>
  
  <p>The filter criteria in logstash conf:</p>
  
  <pre><code>filter {
  
          grok {
              patterns_dir =&gt; ["/home/chamith/work/ELK/logstash/logstash-2.3.4/bin/patterns"]
              match =&gt; { "message" =&gt; "%{GREEDYDATA} %{LOGTIMESTAMP:logtimestamp}" }  
  
          }
          mutate {
              add_field =&gt; {
                  "timestamp" =&gt; "%{LOGTIMESTAMP}"
              }
              remove_field =&gt; ["logtimestamp"]
          }
          date {
              match =&gt; ["logtimestamp", "yyyyMMdd HH:mm:ss"]
              target =&gt; "logtimestamp"
          }           
       }
  </code></pre>
  
  <p>and the output in Kibana:</p>
  
  <p><a href="https://i.stack.imgur.com/zRVoN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zRVoN.png" alt="enter image description here"></a></p>
  
  <p>Any help would be appreciated. </p>