# Logstash Unix Timestamp convert to milliseconds

**URL:** https://discuss.elastic.co/t/logstash-unix-timestamp-convert-to-milliseconds/81067
**Category:** Logstash
**Created:** [April 4, 2017, 12:22am UTC](https://discuss.elastic.co/t/logstash-unix-timestamp-convert-to-milliseconds/81067 "2017-04-04T00:22:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tanong\_montree](https://avatars.discourse-cdn.com/v4/letter/t/ac91a4/32.png) [@tanong\_montree](https://discuss.elastic.co/u/tanong_montree)
#### Post date: [April 4, 2017, 12:22am UTC](https://discuss.elastic.co/t/logstash-unix-timestamp-convert-to-milliseconds/81067/1 "2017-04-04T00:22:53Z")

</div>

Hello, my name is Tongsak.  
Ask how to convert the time unity x into a day, month, second.  
For example, 284465 1486008515154023 1486008515154023 1486008574188849 8 6 776 628 0 - - - - - - 4 2406: 3100: 1020: 1 :: 814 2404: 6800: 4003: 803 :: 200e TCP 51288 443 0 0 0 0 0 0 0 0

Sample data grok filter not work  
}  
Filter {  
Grok {  
% {INT: flow\_start\_timestamp}% {INT: segment\_start\_timestamp}% {INT: segment\_end\_timestamp}% {INT: segment\_packet\_send}% {INT: segment\_packet\_receive}% {INT: segment\_raw\_byte\_send % {INT: segment\_idte}% {DATA: user\_id\_1}% {DATA: login\_session\_id\_2}% {DATA: login\_session\_id\_2}% {DATA: user\_id\_2}%} % {INT: ip\_type}% {IP: src\_ip}% {IP: dst\_ip}% {WORD: protocol}% {INT: src\_port}% {INT: dst\_port}% {DATA: flow\_detected\_l7}% {INT % {INT: segment\_package\_with\_session\_control\_send}% {INT: segment\_package\_with\_session\_control\_receive}% {INT: segment\_package\_with\_session\_control\_session}%  
}  
Mutate {  
Remove\_field =\> ["message"]  
}  
Date {  
Match =\> ["flow\_start\_timestamp", "UNIX\_MS"]  
Target =\> "flow\_start\_timestamp"  
}  
Date {  
Match =\> ["segment\_start\_timestamp", "UNIX\_MS"]  
Target =\> "segment\_start\_timestamp"  
}  
Date {  
Match =\> ["segment\_end\_timestamp", "UNIX\_MS"]  
Target =\> "segment\_end\_timestamp"  
}  
Date {  
Match =\> ["login\_timestamp\_1", "UNIX\_MS"]  
Target =\> "login\_timestamp\_1"  
}  
Date {  
Match =\> ["login\_timestamp\_2", "UNIX\_MS"]  
Target =\> "login\_timestamp\_2"  
}  
}  
Output {  
If "\_grokparsefailure" in [tags] {  
Stdout {  
Codec =\> rubydebug  
}  
Else {else}  
Elasticsearch {  
Hosts =\> ["192.168.206.141:9200"]  
}  
}  
}

How to convert? How to do?

---

<div class="post-metadata">

### Author: ![TWalter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/twalter/32/41239_2.png) [@TWalter](https://discuss.elastic.co/u/TWalter)
#### Post date: [April 4, 2017, 12:44pm UTC](https://discuss.elastic.co/t/logstash-unix-timestamp-convert-to-milliseconds/81067/2 "2017-04-04T12:44:10Z")

</div>

Hey tanong,

when it's a UNIX timestamp, you can convert the timestamp with the Ruby-Filter-Plugin using ruby code. There are a lot of functions for time operations (look at the ruby documentation)

Ich hope i could help you;)

---

<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: [May 2, 2017, 12:44pm UTC](https://discuss.elastic.co/t/logstash-unix-timestamp-convert-to-milliseconds/81067/3 "2017-05-02T12:44:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
