LMM
LMM

Reputation: 1

Replace the last search result

I am currently monitoring the database(Jdbc). This bank refers to product sales, where at first the status of the sale receives "WAITING FOR PAYMENT" and after payment it receives the status of "PAID".

however, when the payment status changes, the log is not updated, so it only counts the first status.

I ask for help on how can I make logstash update the status field dynamically?

the idea is that it is similar to the bank, receiving updates on top of those that already exist, in this way we can mount graphics on top of these updates.

My input is like this:


input {
    jdbc {
        tags => ["oracle"]
        jdbc_driver_library => "/usr/share/logstash/lib/ojdbc8.jar"
        jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
        jdbc_connection_string => "***"
        jdbc_user => "***"
        jdbc_password => "***"
        jdbc_validate_connection => true
        jdbc_paging_enabled => true
        use_column_value => true
        tracking_column => unix_ts_in_secs
        tracking_column_type => "timestamp"
        schedule => "*/1 * * * *"
        statement => "SELECT PRODUCTS.ID, PRODUCTS.STATUS, TO_TIMESTAMP(PRODUCTS.CREATION_DATE) AS unix_ts_in_secs FROM PRODUCTS ON  (TO_TIMESTAMP(PRODUCTS.CREATION_DATE) > :sql_last_value) ORDER BY PRODUCTS.CREATION_DATE ASC"
        record_last_run => true
    }
}

Upvotes: 0

Views: 21

Answers (1)

Bloomstar
Bloomstar

Reputation: 155

In output elastic configuration just update each document with "PRODUCTS.ID" value as below

output {
 elasticsearch {
  ssl => true
  user => "***"
  password => "***"
  hosts => ["https://elastic-ip:9200"]
  keystore => "path to cert"
  keystore_password => "****"
  truststore => "path to cert"
  truststore_password =>"****"
  index => "data-%{+yyyy.MM.dd}"
  document_id => "%{PRODUCTS.ID}"
  doc_as_upsert => true
  action => "update"
 }
}

Upvotes: 0

Related Questions