Logstash sql_last_run took last record twice


(timpamungkas) #1

I use logstash to parse log data from SQL Server, using jdbc input. The jdbc runs every hour. However, every last log entry on previous hour sometimes taken twice by logstash.

For example, the following sequence:

[1. log_id : 101, log_timestamp: 14:12]
2. [log_id : 102, log_timestamp: 14:13]
3. [log_id : 103, log_timestamp: 14:14] > double input for logstash
4. [log_id : 201, log_timestamp: 15:28]
5. [log_id : 202, log_timestamp: 15:29]
6. [log_id : 203, log_timestamp: 15:30] > double input for logstash

Logstash jdbc will runs on 15:03 and 16:03, but it will took 8 records, where log_id 103 and 203 taken twice.
The* log_id 103 will be taken by scheduler on 15:03 and 16:03

  • The log_id 203 will be taken by scheduler on 16:03 and 17:03

However, other log_id is normal
I check the sql_last_run value:

  • after 15:03 scheduler runs, the value of sql_last_run is 14:14
  • after 16:03 scheduler runs, the value of sql_last_run is 15:30

Is there something I miss?

Thanks

Here is my config

	input { 
  # xyz hit rate
  jdbc {
	jdbc_driver_library => "C:\dev\script\config\mssql-jdbc-6.2.2.jre8.jar"
	jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
	jdbc_connection_string => "jdbc:sqlserver://1.2.3.4:1433;databaseName=MYDB;"
	jdbc_user => "user"
	jdbc_password => "password"
	jdbc_validate_connection => true
	schedule => "3 * * * *"
	statement => "SELECT * from myTableLog WHERE DtmUpd > :sql_last_value"
	type => "jdbc"
	tags => ["xyz-hit-rate"]
	tracking_column => "dtmupd"
	use_column_value => true
	last_run_metadata_path => "C:\dev\script\sql\es-jdbc-last-run-btpn.log"
  }
}

(system) #2

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