Skip to content

Instantly share code, notes, and snippets.

@danielmitd
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save danielmitd/32f5bd9e3d8cec5a2b53 to your computer and use it in GitHub Desktop.

Select an option

Save danielmitd/32f5bd9e3d8cec5a2b53 to your computer and use it in GitHub Desktop.
apache combined log with cookie string
input {
file {
path => "/var/log/apache2/access.log"
type => "apache-access-cookies"
}
}
filter {
if [type] == "apache-access-cookies" {
grok {
match => [ "message", "%{COMBINEDAPACHELOG} %{QS:cookie}" ]
}
date {
match => [ "timestamp", "dd/MM/YYYY:HH:mm:ss Z"]
}
if [agent] != "" {
useragent { source => "agent" }
}
geoip {
source => "clientip"
}
kv {
source => "cookie"
target => "cookies"
trim => "\"; "
trimkey => "\""
remove_field => [ "cookie" ]
}
}
}
output {
stdout { }
elasticsearch {
host => localhost
flush_size => 50
protocol => http
}
}
<VirtualHost *:80>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{Cookie}i\"" combinedcookie
CustomLog /var/log/apache2/fudosan_access.log combinedcookie
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment