Created
May 24, 2020 02:32
-
-
Save jgrevich/8006a02406679a97777ff2efcbdf8275 to your computer and use it in GitHub Desktop.
PurpleAir Logstash Configs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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