在 windows 中使用 logstash 将 apache 日志导入 elasticsearch

Import apache logs into elasticsearch using logstash in windows

我对 ELK 堆栈和 Windows cmd 中的命令还很陌生。我正在尝试将下面的示例 运行 放入我的 windows 机器中。我已经在我的机器上安装并配置了 ELK 堆栈,但不知道如何 运行 在 Windows cmd?

中的命令下方

https://github.com/elastic/examples/tree/master/ElasticStack_apache

cat apache_logs | <path_to_logstash_root_dir>/bin/logstash -f apache_logstash.conf

我试过下面的例子,但它没有按预期工作。请帮忙。

type apache_logs >> C:\logstash-5.3.1\bin\logstash.bat -f apache_logstash.conf

你有两个主要的解决方案:

  1. 您可以使用 mingw(git 作为 "git bash" 提供)来使用 linux 风格的管道命令。 (见 http://www.mingw.org/

  2. 或者您可以更改 apache_logstash.conf 文件,替换 input 部分以摄取 apache直接记录文件而不是摄取标准输入并等待管道

实际:

input {  
  stdin { } 
}

替换:

input {
    file {
        path => "<path_to_apache_log_file>"
        start_position => "beginning"
    }
}