Skip to content

Instantly share code, notes, and snippets.

@nmische
Created June 27, 2013 20:20
Show Gist options
  • Save nmische/5880027 to your computer and use it in GitHub Desktop.
Save nmische/5880027 to your computer and use it in GitHub Desktop.
Extended Apache LogFormat for logstash
LogFormat "{ \
\"@source\":\"file://<%= @host %>/<%= @log_path %>/<%= @name %>-logstash.log\", \
\"@source_host\": \"<%= @host %>\", \
\"@source_path\": \"<%= @log_path %>/<%= @name %>-logstash.log\", \
\"@tags\":[\"<%= @host %>\"<% @tags.each do |tag| %>,\"<%= tag %>\"<% end %>], \
\"@message\": \"%h %l %u %t \\\"%r\\\" %>s %b\", \
\"@fields\": { \
\"timestamp\": \"%{%Y-%m-%dT%H:%M:%S%z}t\", \
\"clientip\": \"%a\", \
\"duration\": %D, \
\"status\": %>s, \
\"request\": \"%U%q\", \
\"urlpath\": \"%U\", \
\"urlquery\": \"%q\", \
\"method\": \"%m\", \
\"port\": %p, \
\"bytes\": %B, \
\"vhost\": \"%v\", \
\"referer\": \"%{Referer}i\", \
\"user-agent\": \"%{User-agent}i\", \
\"x-forwarded-for\": \"%{X-Forwarded-For}i\", \
\"cookie\": \"%{Cookie}i\" \
} \
}" <%= @name %>_logstash_apache_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment