# Calculating day of week using log @timestamp filed instead of the logstash @timestamp

**URL:** <https://discuss.elastic.co/t/calculating-day-of-week-using-log-timestamp-filed-instead-of-the-logstash-timestamp/151346>\
**Category:** Logstash\
**Created:** [October 7, 2018, 10:42am UTC](https://discuss.elastic.co/t/calculating-day-of-week-using-log-timestamp-filed-instead-of-the-logstash-timestamp/151346 "2018-10-07T10:42:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ira](https://avatars.discourse-cdn.com/v4/letter/i/9fc348/32.png) [@Ira](https://discuss.elastic.co/u/Ira)\
**Post date:** [October 7, 2018, 10:42am UTC](https://discuss.elastic.co/t/calculating-day-of-week-using-log-timestamp-filed-instead-of-the-logstash-timestamp/151346/1 "2018-10-07T10:42:36Z")

</div>

Hi,

In my JSON log file I have a field called @timestamp:  
{"@timestamp":"2018-10-04T03:07:12.189-04:00","@version":1,"caller\_method\_name":"beforeBodyWrite","caller\_line\_number":119,"elapsedTime":"174"}

When I query the index, I see two @timestamp fields- the one added by logstash and the other one is the one coming from the log line (which are not always the same).

I'm trying to calculate the day of week (I'd like the value to be taken from the my log document) by:  
mutate {  
add\_field =\> {"[weekDayNum]" =\> "%{+e}"}  
}  
However, it's being calculated using logstash's @timstamp.

Is there a way I can calculate the day of week using the value in my log?

Thanks.

---

<div class="post-metadata">

**Author:** ![Ira](https://avatars.discourse-cdn.com/v4/letter/i/9fc348/32.png) [@Ira](https://discuss.elastic.co/u/Ira)\
**Post date:** [October 9, 2018, 7:36am UTC](https://discuss.elastic.co/t/calculating-day-of-week-using-log-timestamp-filed-instead-of-the-logstash-timestamp/151346/2 "2018-10-09T07:36:43Z")

</div>

I would appreciate any idea. I can't figure out how can I make my new "weekDayNum" field to retrieve the value from the @timestamp in my log.  
Thank 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:** [November 6, 2018, 7:36am UTC](https://discuss.elastic.co/t/calculating-day-of-week-using-log-timestamp-filed-instead-of-the-logstash-timestamp/151346/3 "2018-11-06T07:36:43Z")

</div>

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