# Help with converting timestamp

**URL:** https://discuss.elastic.co/t/help-with-converting-timestamp/89215
**Category:** Logstash
**Created:** [June 13, 2017, 2:44pm UTC](https://discuss.elastic.co/t/help-with-converting-timestamp/89215 "2017-06-13T14:44:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pmohan](https://avatars.discourse-cdn.com/v4/letter/p/779978/32.png) [@pmohan](https://discuss.elastic.co/u/pmohan)
#### Post date: [June 13, 2017, 2:44pm UTC](https://discuss.elastic.co/t/help-with-converting-timestamp/89215/1 "2017-06-13T14:44:28Z")

</div>

below is my log line , I use the json filter and that works perfectly fine. I just need to get the log time stamp sorted in a readable format .  
timestamp:"unix timestamp, in nanoseconds, when the log message was created"

"timestamp": 1497360775545000192,

trying this and isn't working  
mutate {

# rename field from 'name' to 'browser\_name'

rename =\> { "timestamp" =\> "logtimestamp" }  
}  
mutate {  
convert =\> {"logtimestamp" =\> "integer" }  
}

date {  
match =\> ["logtimestamp", "UNIX"]  
target =\> "logTimestamp\_updated"  
}

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [June 14, 2017, 5:47am UTC](https://discuss.elastic.co/t/help-with-converting-timestamp/89215/2 "2017-06-14T05:47:38Z")

</div>

The UNIX pattern assumes the input is seconds but you have nanoseconds. I suggest you use UNIX\_MS instead and remove the six last digits of `timestamp` to turn it into milliseconds. You can use a mutate filter's gsub option to trim digits off the tail end.

---

<div class="post-metadata">

### Author: ![pmohan](https://avatars.discourse-cdn.com/v4/letter/p/779978/32.png) [@pmohan](https://discuss.elastic.co/u/pmohan)
#### Post date: [June 14, 2017, 2:25pm UTC](https://discuss.elastic.co/t/help-with-converting-timestamp/89215/3 "2017-06-14T14:25:22Z")

</div>

Thanks so much for your reply !  
It works perfect now!

---

<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 12, 2017, 2:25pm UTC](https://discuss.elastic.co/t/help-with-converting-timestamp/89215/4 "2017-07-12T14:25:34Z")

</div>

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