当前位置: 动力学知识库 > 问答 > 编程问答 >

Logstash output : Tags on stdout

问题描述:

As a newbie in ELK, i'm doing many tests to get used to this environment.

I would like to print the tags generated by Logstash in the the CLI, but I didn't find how.

Is it possible ? I don't want to send it to elasticsearch and then look for the data with Kibana, I just want to know if the tags are here and which ones.

Here is a sample of what i'm trying to do :

I'm using http_poller to get data from a list of URLs, and i'd like to see if the correct HTTPcode is given

input {

http_poller {

urls => {

"url1" => "https://www.google.com"

#"url2" => "https://www.facebook.com"

#"url3" => "https://www.amazon.com"

#"url4" => "http://www.google.com"

#"url5" => "http://www.facebook.com"

#"url6" => "http://www.amazon.com"

}

automatic_retries => 0

#Check les URL toutes les 30sec

interval => 30

#Considere la requete en Timeout au bout de 8secondes

request_timeout => 8

tags => website_healthcheck

}

}

filter{

if [http_poller_metada][code] == 200{

mutate{

add_tag => "Good request"

}

}

}

output {

#Debug

if "Good request" in [tags]{

stdout{

codec => rubydebug

}

}

Right now the output is unreadable (google's html page), I'd like to read only the HttpCode.

Sorry for the poor explanation, and thanks for your answers :)

网友答案:

A solution would be to replace the message field with the tag field, so you will only have the httpCode in your output.

mutate {
  replace => { "message" => "%{[http_poller_metada][code]}" }
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: