# Postgresql Module Missing Field Errors

**URL:** <https://discuss.elastic.co/t/postgresql-module-missing-field-errors/100097>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [September 11, 2017, 4:47pm UTC](https://discuss.elastic.co/t/postgresql-module-missing-field-errors/100097 "2017-09-11T16:47:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwojcicki](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@kwojcicki](https://discuss.elastic.co/u/kwojcicki)\
**Post date:** [September 11, 2017, 4:47pm UTC](https://discuss.elastic.co/t/postgresql-module-missing-field-errors/100097/1 "2017-09-11T16:47:20Z")

</div>

Using PostgreSQL with dockerimage: library/postgres:9.5-alpine my metricbeat container (5.5.0) spits out the following errors:

2017/09/11 16:41:56.911310 schema.go:38: ERR Error on field 'query\_start': Error converting param to time.Time: query\_start. Original:  
2017/09/11 16:41:56.911327 schema.go:38: ERR Error on field 'waiting': Key `waiting` not found

My metricbeat.yml looks like the following (omitted sending to ES etc)

- module: postgresql  
name: postgresql  
enabled: true  
period: 10s  
metricsets: ["database", "bgwriter", "activity"]  
hosts: ["postgres://postgres:5432?sslmode=disable"]  
username: postgres  
password: postgres

---

<div class="post-metadata">

**Author:** ![kwojcicki](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@kwojcicki](https://discuss.elastic.co/u/kwojcicki)\
**Post date:** [September 12, 2017, 2:47pm UTC](https://discuss.elastic.co/t/postgresql-module-missing-field-errors/100097/2 "2017-09-12T14:47:09Z")

</div>

Was actually a problem due to one of the microservices not connecting to postgresql correctly and leaving an empty row in pg\_stat\_activity;

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [September 12, 2017, 2:50pm UTC](https://discuss.elastic.co/t/postgresql-module-missing-field-errors/100097/3 "2017-09-12T14:50:49Z")

</div>

So if there has never been any activity does that mean a user would encounter these error messages with this module?

---

<div class="post-metadata">

**Author:** ![kwojcicki](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@kwojcicki](https://discuss.elastic.co/u/kwojcicki)\
**Post date:** [September 12, 2017, 3:10pm UTC](https://discuss.elastic.co/t/postgresql-module-missing-field-errors/100097/4 "2017-09-12T15:10:53Z")

</div>

Yup exactly if you run a similar query to what metric beat does (select usename, query\_start from pg\_stat\_activity;) you will get something like the following (i am using postgres 9.5 and metricbeat 9.5 so column names can vary but general idea should hold)

```
postgres=# select usename, query_start from pg_stat_activity;
   usename | query_start          
--------------+-------------------------------
 service1 | 2017-09-12 14:41:55.176988+00
 service1 | 2017-09-12 14:41:49.329056+00
 service3 |
 service2 | 2017-09-12 15:07:55.134885+00
 service2 | 2017-09-12 14:41:51.422839+00
 service2 | 2017-09-12 14:41:51.42319+00

```

And as you can see one of the service3 rows has no query\_start since only a connection has been established no query has actually be run yet. I think metricbeat acted as expected but perhaps making that field optional could be a good idea?

---

<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 10, 2017, 3:11pm UTC](https://discuss.elastic.co/t/postgresql-module-missing-field-errors/100097/5 "2017-10-10T15:11:32Z")

</div>

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