# Mask Output

**URL:** https://discuss.elastic.co/t/mask-output/33654
**Category:** Logstash
**Created:** [November 3, 2015, 4:52pm UTC](https://discuss.elastic.co/t/mask-output/33654 "2015-11-03T16:52:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![maisyweb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maisyweb/32/5063_2.png) [@maisyweb](https://discuss.elastic.co/u/maisyweb)
#### Post date: [November 3, 2015, 4:52pm UTC](https://discuss.elastic.co/t/mask-output/33654/1 "2015-11-03T16:52:33Z")

</div>

Hi,

I have a logstash script that reads from an xml file and outputs a json file. It's all working well but I need to update the format of one of the fields.

Currently the field returns a time in HH:mm:ss format (15:00:00)

I need the output to just show HH:mm (15:00)

Can I do this with logstash? Here is my current code

```
if [checkOutBefore] { 
    mutate { replace => ["checkOutBefore", "%{[checkOutBefore][0]}"] }
}else{
    mutate { remove_field => ["checkOutBefore"] }
}
```

---

<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: [November 3, 2015, 6:21pm UTC](https://discuss.elastic.co/t/mask-output/33654/2 "2015-11-03T18:21:10Z")

</div>

Use the mutate filter's gsub option.

```
mutate {
  gsub => ["checkOutBefore", ":\d\d$", ""]
}
```

---

<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, 2017, 5:24am UTC](https://discuss.elastic.co/t/mask-output/33654/3 "2017-07-06T05:24:15Z")

</div>


