# Modify the string into another form in Logstash

**URL:** https://discuss.elastic.co/t/modify-the-string-into-another-form-in-logstash/306732
**Category:** Logstash
**Created:** [June 8, 2022, 5:40pm UTC](https://discuss.elastic.co/t/modify-the-string-into-another-form-in-logstash/306732 "2022-06-08T17:40:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Pranjal\_Sett](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranjal_sett/32/98834_2.png) [@Pranjal\_Sett](https://discuss.elastic.co/u/Pranjal_Sett)
#### Post date: [June 8, 2022, 5:40pm UTC](https://discuss.elastic.co/t/modify-the-string-into-another-form-in-logstash/306732/1 "2022-06-08T17:40:24Z")

</div>

Hello,

I am having one csv file, in that csv file there is a attribute named as Time field. And the format of that time field is not as a standard format.

Here is the format: [30/Nov/2017:15:28:27

And I want to change this format in Logstash to 30/Nov/2017 15:28:27. That means  
[30/Nov/2017:15:28:27 =\> 30/Nov/2017 15:28:27

Can I do that in Logstash?

So that I will map this to in index template and give the custom date format!!

Thanks & Regards,  
Pranjal Sett

---

<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: [June 8, 2022, 6:35pm UTC](https://discuss.elastic.co/t/modify-the-string-into-another-form-in-logstash/306732/2 "2022-06-08T18:35:10Z")

</div>

> [@Pranjal\_Sett](#):
>
> Can I do that in Logstash?

You can do it using mutate+gsub

```
mutate { gsub => ["Time", "^\[", "", "Time", "\/(\d{4}):(\d{2})", "/\1 \2"] }

```

---

<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 6, 2022, 6:35pm UTC](https://discuss.elastic.co/t/modify-the-string-into-another-form-in-logstash/306732/3 "2022-07-06T18:35:54Z")

</div>

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