Skip to content

Instantly share code, notes, and snippets.

@evaristorivi
Last active May 12, 2019 18:54
Show Gist options
  • Select an option

  • Save evaristorivi/522b3facf8277362f912bf67e2d6a374 to your computer and use it in GitHub Desktop.

Select an option

Save evaristorivi/522b3facf8277362f912bf67e2d6a374 to your computer and use it in GitHub Desktop.
SQUID grok filter and output Open Disto for Elasticsearch
input {
beats {
type => "squid"
port => 5044
ssl => true
ssl_certificate_authorities => ["/etc/metricbeat/MyRootCA.pem"]
ssl_certificate => "/etc/metricbeat/odfe-node1.pem"
ssl_key => "/etc/metricbeat/odfe-node1.key"
}
}
filter {
grok {
match => ["message","%{INT:timestamp}.%{INT}\s*%{NUMBER:request_msec:float} %{IPORHOST:src_ip} %{WORD:cache_result}/%{NUMBER:response_status:int} %{NUMBER:response_size:int} %{WORD:http_method} (%{URIPROTO:http_proto}://)?%{IPORHOST:dst_host}(?::%{POSINT:port})?(?:%{DATA:uri_param})? %{USERNAME:cache_user} %{WORD:request_route}/(%{IPORHOST:forwarded_to}|-) %{GREEDYDATA:content_type}"]
add_tag => ["squid"]
}
date {
match => [ "timestamp", "UNIX" ]
}
}
output {
if [source] == "/var/log/squid/access.log" and [type] == "squid" {
elasticsearch {
hosts => ["https://192.168.1.20:9200"]
index => "squid-tikitikiv3"
cacert => "/etc/metricbeat/MyRootCA.pem"
user => admin
password => admin
ssl => true
ssl_certificate_verification => false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment