繁体   English   中英

Windows等效于cat命令,可使用Logstash将数据提取到ElasticSearch中

[英]Windows equivalent for cat command to ingest data into ElasticSearch using Logstash

我正在尝试在Windows 10计算机上运行ELK for NGINX Plus(JSON)示例 ,并且挂断了寻找等效于以下unix命令的Windows以便将日志数据提取到Elasticsearch的Windows:

cat nginxplus_json_logs | <path_to_logstash_root_dir>/bin/logstash -f nginxplus_json_logstash.conf

通过这个问题这个问题,我了解到type可以执行与unix中的cat相同的操作。 我尝试使用完全相同的命令将cat替换为type ,这毫无疑问是行不通的。 这是我的命令和响应:

type nginxplus_json_logs.txt | ../logstash-2.1.1/bin/logstash -f nginxplus_json_logstash.conf

'..' is not recognized as an internal or external command,
operable program or batch file.

是否可以使用type命令复制该操作? 如果是这样,我该如何更改格式化命令的方式?

在Windows上,您的命令应该使用反斜杠“ \\”而不是正斜杠“ /”,并且您需要调用logstash.bat文件而不是logstash

因此,您的命令必须改为如下所示(确保首先将cd插入正确的文件夹):

type nginxplus_json_logs.txt | ..\logstash-2.1.1\bin\logstash.bat -f nginxplus_json_logstash.conf

此外,您拥有的logstash配置文件适用于Logstash 1.5.4,因为您拥有2.1.1,因此可以将elasticsearch输出修改为如下所示:

  elasticsearch {
    hosts => ["localhost:9200"]
    index => "nginxplus_json_elk_example"
    document_type => "logs"
    template => "./nginxplus_json_template.json"
    template_name => "nginxplus_json_elk_example"
    template_overwrite => true
  }

暂无
暂无

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

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