# Packetbeat - Postgres - pgsql.error\_code parsing issues

**URL:** <https://discuss.elastic.co/t/packetbeat-postgres-pgsql-error-code-parsing-issues/146541>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [August 29, 2018, 2:08pm UTC](https://discuss.elastic.co/t/packetbeat-postgres-pgsql-error-code-parsing-issues/146541 "2018-08-29T14:08:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [August 29, 2018, 2:08pm UTC](https://discuss.elastic.co/t/packetbeat-postgres-pgsql-error-code-parsing-issues/146541/1 "2018-08-29T14:08:22Z")

</div>

Hello,

The Packetbeat Postgres`pgsql.error_code` can also contain non-long type data, such as `42P01`

[https://www.postgresql.org/docs/8.2/static/errcodes-appendix.html](https://www.postgresql.org/docs/8.2/static/errcodes-appendix.html)

```
[2018-08-29T14:31:17,274][DEBUG][o.e.a.b.TransportShardBulkAction] [packetbeat-6.3.2-2018.08.29][2] failed to execute bulk item (index) BulkShardRequest [[packetbeat-6.3.2-2018.08.29][2]] containing [10] requests
org.elasticsearch.index.mapper.MapperParsingException: failed to parse [pgsql.error_code]
        at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:302) ~[elasticsearch-6.3.2.jar:6.3.2]
        at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrField(DocumentParser.java:481) ~[elasticsearch-6.3.2.jar:6.3.2]
        at org.elasticsearch.index.mapper.DocumentParser.parseValue(DocumentParser.java:603) ~[elasticsearch-6.3.2.jar:6.3.2]
        at org.elasticsearch.index.mapper.DocumentParser.innerParseObject(DocumentParser.java:403) ~[elasticsearch-6.3.2.jar:6.3.2]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_131]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
Caused by: java.lang.IllegalArgumentException: For input string: "42P01"
        at org.elasticsearch.common.xcontent.support.AbstractXContentParser.toLong(AbstractXContentParser.java:199) ~[elasticsearch-x-content-6.3.2.jar:6.3.2]
        at org.elasticsearch.common.xcontent.support.AbstractXContentParser.longValue(AbstractXContentParser.java:220) ~[elasticsearch-x-content-6.3.2.jar:6.3.2]
        at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$7.parse(NumberFieldMapper.java:679) ~[elasticsearch-6.3.2.jar:6.3.2]
        at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$7.parse(NumberFieldMapper.java:655) ~[elasticsearch-6.3.2.jar:6.3.2]
        at org.elasticsearch.index.mapper.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:996) ~[elasticsearch-6.3.2.jar:6.3.2]
        at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:297) ~[elasticsearch-6.3.2.jar:6.3.2]
        ... 64 more

```

At the moment the data type is `long`

[https://www.elastic.co/guide/en/beats/packetbeat/current/exported-fields-pgsql.html](https://www.elastic.co/guide/en/beats/packetbeat/current/exported-fields-pgsql.html)

Should I create a GitHb issue for this?

Grtz

Willem

---

<div class="post-metadata">

**Author:** ![cwurm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cwurm/32/34882_2.png) [@cwurm](https://discuss.elastic.co/u/cwurm)\
**Post date:** [August 31, 2018, 11:50am UTC](https://discuss.elastic.co/t/packetbeat-postgres-pgsql-error-code-parsing-issues/146541/2 "2018-08-31T11:50:26Z")

</div>

> [@willemdh](#):
>
> Should I create a GitHb issue for this?

Yes please, and paste the link here. `error_code` should have type `keyword` not `long`.

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 5, 2018, 1:12pm UTC](https://discuss.elastic.co/t/packetbeat-postgres-pgsql-error-code-parsing-issues/146541/3 "2018-09-05T13:12:52Z")

</div>

GitHub issue created =\> [https://github.com/elastic/beats/issues/8241](https://github.com/elastic/beats/issues/8241)

---

<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:** [October 3, 2018, 3:12pm UTC](https://discuss.elastic.co/t/packetbeat-postgres-pgsql-error-code-parsing-issues/146541/4 "2018-10-03T15:12:56Z")

</div>

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