N
N
nurzhannogerbek2018-09-27 10:53:52
elasticsearch
nurzhannogerbek, 2018-09-27 10:53:52

How to merge data from columns in logstash setup?

Hello comrades! Please help me figure it out.
There is a table in a PostgreSQL database. This table has two fields that store the time. The first one stores only the time (for example: 02 or 18), the second one stores the date (for example: 2018-09-25).
Logstash receives data from PostgreSQL as input. Now I'm trying to filter the data in such a way that the above two fields are combined as a single timestamp, so that it would be easier to visualize the data in Kibana using it. Tell me what to write in the filter block of the logstash.conf file to combine the hour and date fields?
logstash.conf :

input {
    jdbc {
        jdbc_connection_string => "jdbc:postgresql://host:port/db"
        jdbc_user => "postgres"
        jdbc_password => "postgres"
        jdbc_driver_library => "postgresql-42.2.5.jar"
        jdbc_driver_class => "org.postgresql.Driver"
        statement => "SELECT * from documents"
    }
}
filter {
    # ???
}
output {
    elasticsearch {
        hosts => ["localhost:9200"]
        index => "documents"
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-09-27
@dimonchik2013

"SELECT * from documents"
you change to the correct one with concat there or with + , only xs how it will be if not strings, maybe a more fun query

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question