美文网首页
ELK-验证是否安装成功

ELK-验证是否安装成功

作者: perfect_jimmy | 来源:发表于2017-02-21 16:59 被阅读175次

    验证Logstash

    [root@localhost logstash]# bin/logstash -e 'input { stdin { } } output { stdout {} }'
    Sending Logstash's logs to /var/log/logstash which is now configured via log4j2.properties
    The stdin plugin is now waiting for input:
    hello world
    2017-02-21T08:23:56.878Z localhost.localdomain hello world
    

    1.执行logstash -e 'input { stdin { } } output { stdout {} }'
    2.-e 参数允许Logstash直接通过命令行接受设置
    3.无论我们输入什么字符,Logstash都会按照某种格式来返回我们输入的字符

    在output中加入codec可以改变输出变现

    [root@localhost logstash]# bin/logstash -e 'input { stdin { } } output { stdout { codec => rubydebug } }'
    Sending Logstash's logs to /var/log/logstash which is now configured via log4j2.properties
    The stdin plugin is now waiting for input:
    hello world again
    {
        "@timestamp" => 2017-02-21T08:30:58.821Z,
          "@version" => "1",
              "host" => "localhost.localdomain",
           "message" => "hello world again"
    }
    

    验证数据是否发送到Elasticsearch

    [root@localhost logstash]# bin/logstash -e 'input { stdin { } } output { elasticsearch { hosts => ["172.16.24.105:9200"] } }'
    Sending Logstash's logs to /var/log/logstash which is now configured via log4j2.properties
    The stdin plugin is now waiting for input:
    test send elasticsearch
    

    1.output里面配置elasticsearch的地址
    2.输入数据之后,logstash会像之前那样处理数据,但是此次看不到输出(没有配置stdout)
    3.curl 'http://localhost:9200/_search?pretty'--查看ES是否接受到了数据

    多重输出:数据保存到ES,同时在控制台显示

    bin/logstash -e 'input { stdin { } } output { elasticsearch { hosts => ["172.16.24.105:9200"] } stdout { codec => rubydebug}}'

    相关文章

      网友评论

          本文标题:ELK-验证是否安装成功

          本文链接:https://www.haomeiwen.com/subject/zvduwttx.html