基于mq搭建elk
基于mq搭建elk
其实elk就是ES,Logstash,kibana,那ES的数据源由很多,本文主要讲下通过mq把数据扔到es然后通过kibana展示
Logstash是一个开源数据收集引擎,具有实时管道功能。Logstash可以动态地将来自不同数据源的数据统一起来,并将数据标准化到你所选择的目的地
input {
rabbitmq {
exchange => "notificationExchage"
exchange_type => "topic"
key => "xwxlogstash"
host => "172.16.20.1"
port => 5672
user => "test"
password => "itsme999"
queue => "xwxlogstash"
auto_delete => false
vhost => "/dev"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "xwxlogstash_log_mq"
}
}
<appender name="RabbitMq" class="org.springframework.amqp.rabbit.logback.AmqpAppender">
<host>172.16.20.1</host>
<port>5672</port>
<username>test</username>
<password>itsme999</password>
<virtualHost>/dev</virtualHost>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<routingKeyPattern>xwxlogstash</routingKeyPattern>
<declareExchange>true</declareExchange>
<exchangeType>topic</exchangeType>
<exchangeName>notificationExchage</exchangeName>
<generateId>true</generateId>
<durable>false</durable>
<declareExchange>true</declareExchange>
<autoDelete>false</autoDelete>
<charset>UTF-8</charset>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>
<![CDATA[%msg]]>
</pattern>
</layout>
</appender>
- 在management中添加es索引
Lucene查询语法
- 为了执行一个文本搜索,可以简单的输入一个文本字符串,例如:千与千寻