# Custom pattern

**URL:** <https://discuss.elastic.co/t/custom-pattern/115617>\
**Category:** Logstash\
**Created:** [January 16, 2018, 1:04am UTC](https://discuss.elastic.co/t/custom-pattern/115617 "2018-01-16T01:04:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zpraxis](https://avatars.discourse-cdn.com/v4/letter/z/5daacb/32.png) [@zpraxis](https://discuss.elastic.co/u/zpraxis)\
**Post date:** [January 16, 2018, 1:04am UTC](https://discuss.elastic.co/t/custom-pattern/115617/1 "2018-01-16T01:04:27Z")

</div>

Hi!

I'm defining a custom pattern like the following, and at the same time trying to add a data type conversion.

So far, I've tried these without success:

`code=(?<myCode:int>%{POSINT}|null|NULL|%{SPACE})`

`code=(?<myCode>%{POSINT:int}|null|NULL|%{SPACE})`

It is not working due to the data type conversion, so I'm wondering how it should be indicated.

Thanks in advance.

---

<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:** [February 13, 2018, 1:04am UTC](https://discuss.elastic.co/t/custom-pattern/115617/2 "2018-02-13T01:04:52Z")

</div>

Closed on February 13, 2018, 1:04am UTC

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