# Add a new field with a specifically formatted timestamp from @timestamp

**URL:** https://discuss.elastic.co/t/add-a-new-field-with-a-specifically-formatted-timestamp-from-timestamp/287373
**Category:** Logstash
**Created:** [October 21, 2021, 11:53pm UTC](https://discuss.elastic.co/t/add-a-new-field-with-a-specifically-formatted-timestamp-from-timestamp/287373 "2021-10-21T23:53:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![trwillis](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@trwillis](https://discuss.elastic.co/u/trwillis)
#### Post date: [October 21, 2021, 11:53pm UTC](https://discuss.elastic.co/t/add-a-new-field-with-a-specifically-formatted-timestamp-from-timestamp/287373/1 "2021-10-21T23:53:58Z")

</div>

I want to take the value from @timestamp, format it like "yyyy MM dd HH:mm:ss" and prepend it to the message field. Input data is syslog in json format.

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [October 22, 2021, 12:25am UTC](https://discuss.elastic.co/t/add-a-new-field-with-a-specifically-formatted-timestamp-from-timestamp/287373/2 "2021-10-22T00:25:17Z")

</div>

To format a timestamp as a string, use a ruby filter and strftime. There is an example [here](https://discuss.elastic.co/t/changing-time-format/278115/2). To prepend it to the message field you can use

```
mutate { replace => { "message" => "%{[@metadata][someField]} %{message}" } }
```

---

<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 19, 2021, 12:25am UTC](https://discuss.elastic.co/t/add-a-new-field-with-a-specifically-formatted-timestamp-from-timestamp/287373/3 "2021-11-19T00:25:22Z")

</div>

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