Skip to content
Advertisement

how to save database versioning as a sql_last_version variable in logstash

What I’m trying to do is to save the greatest version of rows in the sql_last_value parameter as shown below in my log.conf file after each time it executes.

This is my log.conf for logstash:

for instance, this is my table:

I’m expecting to store 600 as the last_version parameter.

I’m sure if mistaken or not, I’ve got no ideas here, please help. I’m a total newbie to logstash.

Thanks in advance.

Advertisement

Answer

The parameter is called sql_last_value and here is how you can use it:

Here are the modification I made:

  • You don’t need the parameters setting
  • You’re missing the use_column_value setting
  • You’re missing the tracking_column setting
  • The SQL query needs to reference sql_last_value not sql_last_version

After the first run, 600 will be stored in sql_last_value and used in the next call to only retrieve records whose xmin value is >= 600 (which means the last record will be fetched again)

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement