Skip to content

Instantly share code, notes, and snippets.

@zabaala
Created November 30, 2017 16:40
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 zabaala/491530526e6e60d5a9c594e14b94ed02 to your computer and use it in GitHub Desktop.
Save zabaala/491530526e6e60d5a9c594e14b94ed02 to your computer and use it in GitHub Desktop.
input {
file {
path => "/data/logs/laravel/laravel.log"
start_position => "beginning"
type => "laravel_core_log"
codec => multiline {
pattern => "^\["
what => "previous"
negate => true
}
}
file {
path => "/data/logs/laravel/invoices.log"
type => "invoices_log"
codec => json
}
}
filter {
if [type] == "laravel_core_logs" {
grok {
match => { "message" => "\[%{TIMESTAMP_ISO8601:timestamp}\] %{DATA:env}\.%{DATA:severity}: %{DATA:message}" }
}
}
if [type] == "invoices_log" {
grok {
match => { "message" => "\[%{TIMESTAMP_ISO8601:timestamp}\] application=%{DATA:application} event=%{DATA:index}\.%{DATA:event} data=%{GREEDYDATA:event_body}" }
}
json {
source => "event_body"
}
}
}
output {
if [type] == "laravel_core_log" {
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "laravel_logs"
}
}
if [type] == "invoices_log" {
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "analytics_log"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment