I am trying to migrate all the Tables from the database. The output received gives only the 1st Table data values in the elasticsearch. Can anyone help me. Thanks in Advance.
logstash.conf
input {
jdbc {
jdbc_driver_library => "C:\Users\ANSHUMAN\Desktop\mysql-connector-java-5.1.44\SQL JDBC\Microsoft JDBC Driver 6.0 for SQL Server\sqljdbc_6.0\enu\jre8\sqljdbc42.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://ANSHUMAN_DEVICE\TEST_SQL;databaseName=soc;user=sa;password=pass;"
jdbc_user => ""
#our Query
statement_filepath => "SQLQuery2.sql"
}
}
output{
stdout { codec => json_lines }
elasticsearch{
"hosts" => ["localhost:9200"]
"index" => "soctest2"
"document_type" => "Tables"
}
}
SQLQuery2.sql
DECLARE @sqlTest VARCHAR (MAX)
SET @sqlTest = ''
SELECT @sqlTest = @sqlTest + 'SELECT * FROM ' + QUOTENAME (name) + CHAR (13) from sys.tables
EXEC (@sqlTest)