elasticsearchlogstashelklogstash-jdbc

How can I manually trigger timing jdbc input in logstash?


I have one timing jdbc logstash input and load data into elasticsearch.

input {
    jdbc {
        jdbc_connection_string => "XXX"
        jdbc_user => "XXX"
        jdbc_password => "XXX"
        jdbc_validate_connection => true
        jdbc_driver_library => "XXX"
        jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
        statement => "XXX"
        schedule => "0 3 * * * America/New_York"
        type => "XXX"
        add_field => { "[@metadata][indexname]" => "XXX" }
    }
}
output {
    elasticsearch {
        hosts=> ["XXX","XXX","XXX"]
        index=>"%{[@metadata][indexname]}"
        user => XXX
        password => XXX
        ssl => true
        ssl_certificate_verification => false
        cacert => 'XXX'
        document_id => "%{uniqueid}"
    }
    stdout {}
}

I wonder how can I manually trigger it running, if there have some jdbc connection failed or elasticsearch connection issue?


Solution

  • You can run the logstash on command line like the following.

    bin/logstash -f mypipeline.conf
    

    Because you have stdout you will also see the output on the terminal. https://www.elastic.co/guide/en/logstash/current/running-logstash-command-line.html

    Note: if it's slow don't worry the stdout is a performance killer :) Recommended to remove it on prod after testing.

    Note2: Remove schedule in logstash.conf during test otherwise you should wait until the schedule time.