SQL query from Logstash causes an error PGobject

(Igor) #1

Logstash passes a request type:

SELECT * from dbmon_stat_activity()

I get an error in the log:

_[2018-07-02T14:00:00,384][WARN ][logstash.inputs.jdbc ] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::OrgLogstash::MissingConverterException: Missing Converter handling for full class name=org.postgresql.util.PGobject, simple name=PGobject>}_

The function that is called by this query:

CREATE OR REPLACE FUNCTION public.dbmon_stat_activity()
RETURNS SETOF pg_stat_activity
     LANGUAGE plpgsql
    AS $function$
     rcrd RECORD;
      FOR rcrd IN SELECT * FROM pg_stat_activity
        RETURN NEXT rcrd;
      END LOOP;

In accordance with what is written here and here I need to select the type of data in the table.
How can this be done in a function or is it necessary to edit a table?

If you manually execute this query, then everything works without errors.
Is this error related to JDBC?
Are there any alternative versions of the driver?

Thank you in advance

(Magnus B├Ąck) #2

One of the columns returned by the query has a data type that Logstash doesn't know how to handle. You can type cast that column to a recognized data type (e.g. VARCHAR) in the query's SELECT statement.

(system) #4

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