2

I have been trying to search this online, but couldn't get any lead. Is there a way we can print logstash execution output to a log file? For example, I am using a jdbc plugin to read data as per sql_last_start. I want to know at what time the query was executed, how many records in response and what time was the next execution.

Assuming a table test has columns [id,name,updated_on] Code below :

input {
    jdbc {      
        jdbc_connection_string => "jdbc:oracle:oci:MyDB"       
        jdbc_user => "testUser"
        jdbc_password => "testPassword"        
        jdbc_driver_library => "C:\app\Administrator\product\11.2.0\client_1\ojdbc6.jar"     
        jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"    
        statement => "SELECT * from test where updated_on >= :sql_last_start"
        schedule => "* * * * *"
        jdbc_fetch_size=>3
    }
}
output {
    stdout { codec => rubydebug }
    file {
             path => "C:\logstashOutput.txt"
             message_format => "%{@timestamp}: %{id} - %{name} at :sql_last_start"
       }
}
Crickcoder
  • 2,135
  • 4
  • 22
  • 36

1 Answers1

1

You can add parameter log level parameter when you start Logstash

--verbose
Increase verbosity to the first level, less verbose.

--debug
Increase verbosity to the last level, more verbose.

For example:

./logstash-1.4.2/bin/logstash agent -f YOUR_CONFIG_FILE --verbose
Ban-Chuan Lim
  • 7,840
  • 4
  • 35
  • 52