Skip to content

Instantly share code, notes, and snippets.

@markwalkom
Last active April 21, 2020 20:50
Show Gist options
  • Save markwalkom/7f1f20d6da7a7eb5e84843f757e2e258 to your computer and use it in GitHub Desktop.
Save markwalkom/7f1f20d6da7a7eb5e84843f757e2e258 to your computer and use it in GitHub Desktop.
PiHole + Elasticsearch Ingest processing

NOTE - this was specifically built for a docker instance, with the Filebeat docker module collecting the logs.

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
# we need to do two when.contains here
hosts: ["192.168.1.199:9206"]
index: "filebeat-%{[beat.version]}-%{+yyyy.MM}"
indices:
- index: "filebeat-%{[beat.version]}-pihole-%{+yyyy.MM}"
when.contains:
message: "dnsmasq"
pipelines:
- pipeline: "pihole-logging"
when.contains:
message: "dnsmasq"
PUT _ingest/pipeline/pihole-logging
{
"description" : "Pi-Hole Logging",
"processors": [
{
"grok": {
"field": "message",
"patterns": ["%{WORD:program_name}: %{POSINT:query_id} %{NOTSPACE:query_source} query%{NOTSPACE:query_record} %{NOTSPACE:query_target} from %{NOTSPACE:query_source}","%{WORD:program_name}: %{POSINT:query_id} %{NOTSPACE:query_source} %{NOTSPACE:query_action} %{NOTSPACE:query_target} is %{NOTSPACE:query_answer}"]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment