简体   繁体   English

Logstash标准输出-写入文件

[英]Logstash stdout - write into file

Am using logstash to get data from Oracle DB to Elastic Search. 我正在使用logstash将数据从Oracle DB获取到Elastic Search。 I used stdout { codec => rubydebug } its printing log in console. 我在控制台中使用了stdout { codec => rubydebug }它的打印日志。 I want to write into a file. 我要写入文件。

How can we write the log into a file. 我们如何将日志写入文件。

Please find my logstash config file. 请找到我的logstash配置文件。

input {
  jdbc {
    jdbc_driver_library => "D:\1SearchEngine\data\ojdbc8.jar"
    jdbc_driver_class => "Java::oracle.jdbc.OracleDriver"
    jdbc_connection_string => "jdbc:oracle:thin:@localhost:1521:XE"
    jdbc_user => "demo"
    jdbc_password => "1234567"
    statement => "select * from product"    


 }
}

output {

     stdout { codec => rubydebug }  

  elasticsearch {
    hosts => ["localhost:9200"]
    index => "replacement"
    document_id => "%{ID}"
  }
}
logstash.bat -f [path to config file] >> [path to log file]

For example: 例如:

 logstash.bat -f myconfig.config >> "C:\Users\test\Desktop\log.txt"

Note: Make sure the file has write permissions given to the process. 注意:确保文件具有授予该进程的写权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM