Skip to content

Instantly share code, notes, and snippets.

@linuxmalaysia
Created March 25, 2019 23:31
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 linuxmalaysia/7957448925b72bd05558966a6534f95f to your computer and use it in GitHub Desktop.
Save linuxmalaysia/7957448925b72bd05558966a6534f95f to your computer and use it in GitHub Desktop.
Logstash Grok Pattern for Bind9 input using Filebeat
### Logstash Grok Pattern for Bind9 input using Filebeat
%{BIND9_TIMESTAMP:timestamp}%{SPACE}%{LOGLEVEL:loglevel}:%{SPACE}client%{SPACE}%{IP:clientip}#%{POSINT:clientport}%{SPACE}\(%{DATA:query}\):%{SPACE}view%{SPACE}internal:%{SPACE}query:%{SPACE}%{DATA:query2} %{DATA:queryclass} %{DATA:querytype} %{DATA:queryflag} \(%{IP:dnsip}\)
####
grok {
match => {
"message" => [ "%{BIND9_TIMESTAMP:timestamp}%{SPACE}%{LOGLEVEL:loglevel}:%{SPACE}client%{SPACE}%{IP:clientip}#%{POSINT:clientport}%{SPACE}\(%{DATA:query}\):%{SPACE}view%{SPACE}internal:%{SPACE}query:%{SPACE}%{DATA:query2} %{DATA:queryclass} %{DATA:querytype} %{DATA:queryflag} \(%{IP:dnsip}\)" ]
}
tag_on_failure => [ "failedPattern_dns_rule1" ]
add_field => [ "received_at", "%{@timestamp}" ]
add_tag => [ "dns_query" ]
}
### Logstash Date
### 26-Mar-2019 00:08:47.105
date {
locale => "en"
timezone => "Asia/Kuala_Lumpur"
match => ["timestamp", "d-MMM-yyyy HH:mm:ss.SSS", "dd-MMM-yyyy HH:mm:ss.SSS"]
remove_field => ["timestamp"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment