title: How to add sequence id when using logstash to parse log
body: <p>I want to index hadoop logs with logstash and elasticsearch.
  Here is my problem:
  I load logs into elasticsearch by logstash and I hope to search events by elasticsearch and keep the order of events as same as it in original log files. But it doesn't work.
  For example, the events in original log file maybe looks like:</p>
  
  <pre><code>2013-12-25 23:10:19,022 INFO A..
  2013-12-25 23:10:19,022 INFO B..
  2013-12-25 23:10:19,022 INFO C..
  </code></pre>
  
  <p>But when I search it using elasticsearch by the keyword "@timestamp",the result maybe like this:</p>
  
  <pre><code>2013-12-25 23:10:19,022 INFO B..
  2013-12-25 23:10:19,022 INFO A..
  2013-12-25 23:10:19,022 INFO C..
  </code></pre>
  
  <p>Because timestampa are same in this three events, the search result can not keep the order as before.</p>
  
  <p>Here is my solution:
  I think I can add a id for each event, the id is added when logstash parsing the data and it increases with the timestamp. Then when I search events, I can use ids instead of timestamps and they will keep right order even when their timastamp are same.</p>
  
  <p>But I don't know how to add the extra autoincremental 'id' field using logstash, I considered the conf file of logstash and didn't find the solution.
  Please give me some advices of how I can implement this, thanks a lot!</p>