# Gork not work as excpected

**URL:** <https://discuss.elastic.co/t/gork-not-work-as-excpected/337389>\
**Category:** Elasticsearch\
**Created:** [July 2, 2023, 11:02am UTC](https://discuss.elastic.co/t/gork-not-work-as-excpected/337389 "2023-07-02T11:02:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Indeed2000](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@Indeed2000](https://discuss.elastic.co/u/Indeed2000)\
**Post date:** [July 2, 2023, 11:02am UTC](https://discuss.elastic.co/t/gork-not-work-as-excpected/337389/1 "2023-07-02T11:02:49Z")

</div>

Hi  
Here is my gork filter:  
`\[SqlExceptionHelper\] SQL (Error|Warning Code): %{NUMBER:error_code}, SQLState: %{WORD:sql_state}`

here is my log:

```auto
2023-06-30 01:54:38,867 WARN CUS.InEP-APPGW-121662220 [SqlExceptionHelper] SQL Error: -271, SQLState: IX000
2023-06-30 18:55:11,863 WARN CUS.InEP-APPGW-131544990_APP.InEP-APP2-131544666 [SqlExceptionHelper] SQL Warning Code: 0, SQLState: 01I01

```

current output:

```auto
{
  "error_code": "-271",
  "sql_state": "IX000"
}

```

expected output:

```auto
{
  "error_code": "271",
  "sql_state": "IX000"
}

```

need to remove that dash before number in match not with "if condition"

Any idea?  
Thanks

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [July 2, 2023, 4:09pm UTC](https://discuss.elastic.co/t/gork-not-work-as-excpected/337389/2 "2023-07-02T16:09:51Z")

</div>

You can simple use gsub to remove -

` mutate { gsub => ["error_code", "-", ""] }`

---

<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 30, 2023, 4:09pm UTC](https://discuss.elastic.co/t/gork-not-work-as-excpected/337389/3 "2023-07-30T16:09:55Z")

</div>

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