Skip to content

Instantly share code, notes, and snippets.

@jgrevich
Created May 24, 2020 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgrevich/8006a02406679a97777ff2efcbdf8275 to your computer and use it in GitHub Desktop.
Save jgrevich/8006a02406679a97777ff2efcbdf8275 to your computer and use it in GitHub Desktop.
PurpleAir Logstash Configs
input {
http_poller {
add_field => { "purpleair.location" => "indoor" }
codec => "json"
schedule => { every => "11s" }
urls => {
purpleair_1 => "http://192.168.1.2/json"
purpleair_2 => "http://192.168.1.3/json"
purpleair_3 => "http://192.168.1.4/json"
}
target => "purpleair"
type => "purpleair"
}
}
input {
http_poller {
add_field => { "purpleair.location" => "outdoor" }
codec => "json"
schedule => { every => "11s"}
urls => {
purpleair_4 => "http://192.168.1.5/json"
purpleair_5 => "http://192.168.1.6/json"
}
target => "purpleair"
type => "purpleair"
}
}
output {
if [type] == "purpleair" {
elasticsearch {
hosts => ["localhost:9200"]
index => "purpleair-%{[purpleair][version]}-%{+YYYY.MM.dd}"
}
} else {
elasticsearch {
hosts => ["localhost:9200"]
index => "logstash-%{+yyyy.MM.dd}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment