many thanks,
I chanmged my configuration as following:
input {
jdbc {
jdbc_driver_library => "F:\driver\sqljdbc_6.0\enu\jre8\sqljdbc42.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://local:3333;databaseName=TotalTXN"
jdbc_user => "sss"
jdbc_password => "sss"
clean_run => "true"
statement => "
select TOP 2 [BaseDate_Accept_Setel]
from dbo.vw_Total where (BaseDate_Accept_Setel=(SELECT REPLACE(MAX(Date),'/','') from TotalTXN.dbo.TotalTxn_Control)) AND (BaseDate_Accept_Setel> :sql_last_value)
"
use_column_value => "true"
tracking_column => "BaseDate_Accept_Setel"
}
}
filter {
jdbc_streaming {
jdbc_driver_library => "F:\driver\sqljdbc_6.0\enu\jre8\sqljdbc42.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://local:3333;databaseName=TotalTXN"
jdbc_user => "sss"
jdbc_password => "sss"
statement => "DECLARE @DDate CHAR(10)
select @DDate=MAX(Date) from TotalTXN.dbo.TotalTxn_Control
SELECT TotalTXN.dbo.d2md(@DDate) as gdate"
target => "gdate"
}
mutate {
gsub => [
"gdate", "/", "-"
]
}
}
output {
elasticsearch {
hosts => ["http://192.168.170.153:9200"]
index => "a6_%{gdate}"
user => "logstash_internal25"
password => "x-pack-test-password"
}
stdout { codec => rubydebug }
}
but it give me following error:
[2019-02-24T17:42:55,369][ERROR][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"a6_{gdate=2019/02/23}", :_type=>"doc", :routing=>nil}, #<LogStash::Event:0x2342cdee>], :response=>{"index"=>{"_index"=>"a6_{gdate=2019/02/23}", "_type"=>"doc", "_id"=>nil, "status"=>400, "error"=>{"type"=>"invalid_index_name_exception", "reason"=>"Invalid index name [a6_{gdate=2019/02/23}], must not contain the following characters [ , \", *, \\, <, |, ,, >, /, ?]", "index_uuid"=>"_na_", "index"=>"a6_{gdate=2019/02/23}"}}}}
actually, it seems mutate filter is not working