Skip to content

Commit

Permalink
Fix Grok pattern for Home Assistant
Browse files Browse the repository at this point in the history
The `WORD` type does not include dashes, which can be used in Home Assistant thread names.
  • Loading branch information
anton-johansson committed Nov 4, 2018
1 parent c303928 commit f6207e5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion logstash/pipeline/01-home-assistant.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
filter {
if [docker][name] == "home-assistant" {
grok {
match => ["message", "^%{TIMESTAMP_ISO8601} %{WORD:severity} \(%{WORD:thread}\) \[%{GREEDYDATA:name}\] %{GREEDYDATA:message}$"]
match => ["message", "^%{TIMESTAMP_ISO8601} %{WORD:severity} \(%{GREEDYDATA:thread}\) \[%{GREEDYDATA:name}\] %{GREEDYDATA:message}$"]
overwrite => ["message"]
}
mutate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"host": "localhost",
"message": "Bus:Handling <Event state_changed[L]: entity_id=sensor.processor_use, old_state=<state sensor.processor_use=12; unit_of_measurement=%, friendly_name=CPU, icon=mdi:memory @ 2018-05-27T11:26:21.267940+02:00>, new_state=<state sensor.processor_use=22; unit_of_measurement=%, friendly_name=CPU, icon=mdi:memory @ 2018-05-27T11:26:52.274195+02:00>>",
"thread": "MainThread",
"thread": "Main-Thread",
"severity": "INFO",
"name": "homeassistant.core",
"type": "application"
Expand Down
2 changes: 1 addition & 1 deletion logstash/test/test_cases/01-home-assistant.input.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"id" : "74ab19cd30b403e00d6634d9951224e83305208a22f12911de6cabbbd5997d32",
"hostname" : "74ab19cd30b4"
},
"message": "2018-05-27 11:26:52 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.processor_use, old_state=<state sensor.processor_use=12; unit_of_measurement=%, friendly_name=CPU, icon=mdi:memory @ 2018-05-27T11:26:21.267940+02:00>, new_state=<state sensor.processor_use=22; unit_of_measurement=%, friendly_name=CPU, icon=mdi:memory @ 2018-05-27T11:26:52.274195+02:00>>",
"message": "2018-05-27 11:26:52 INFO (Main-Thread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.processor_use, old_state=<state sensor.processor_use=12; unit_of_measurement=%, friendly_name=CPU, icon=mdi:memory @ 2018-05-27T11:26:21.267940+02:00>, new_state=<state sensor.processor_use=22; unit_of_measurement=%, friendly_name=CPU, icon=mdi:memory @ 2018-05-27T11:26:52.274195+02:00>>",
"host": "localhost"
}

0 comments on commit f6207e5

Please sign in to comment.