-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) logstash now parse application logs (manon.log)
- Loading branch information
1 parent
ce5fc52
commit 966969f
Showing
8 changed files
with
109 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
MSECOND [0-9]{3} | ||
LOGBACK_DATE %{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND}.{1}%{MSECOND} | ||
THREAD_ID [^\]]* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
input { | ||
|
||
# ------------------------------ | ||
# ------ Nginx access logs | ||
# ------------------------------ | ||
file { | ||
path => "/manon-nginx/access*.log" | ||
start_position => "beginning" | ||
type => "manon_nginx_access_logs" | ||
|
||
# always (re)parse all existing files, don't use it in production | ||
sincedb_path => "/dev/null" | ||
} | ||
|
||
# ------------------------------ | ||
# ------ Manon logs | ||
# ------------------------------ | ||
file { | ||
path => "/manon-app/manon*.log" | ||
start_position => "beginning" | ||
type => "manon_app_logs" | ||
|
||
# always (re)parse all existing files, don't use it in production | ||
sincedb_path => "/dev/null" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# see https://github.com/elastic/logstash/blob/v1.4.2/patterns/grok-patterns | ||
|
||
filter { | ||
|
||
# ------------------------------ | ||
# ------ Nginx access logs | ||
# ------------------------------ | ||
if [type] == "manon_nginx_access_logs" { | ||
grok { | ||
match => [ "message" , "%{COMBINEDAPACHELOG}+%{GREEDYDATA:extra_fields}"] | ||
overwrite => [ "message" ] | ||
} | ||
mutate { | ||
convert => ["response", "integer"] | ||
convert => ["bytes", "integer"] | ||
convert => ["responsetime", "float"] | ||
} | ||
date { | ||
match => [ "timestamp" , "dd/MMM/YYYY:HH:mm:ss Z" ] | ||
remove_field => [ "timestamp" ] | ||
} | ||
useragent { | ||
source => "agent" | ||
} | ||
} | ||
|
||
# ------------------------------ | ||
# ------ Manon logs | ||
# ------------------------------ | ||
if [type] == "manon_app_logs" { | ||
grok { | ||
match => { "message" =>"%{LOGBACK_DATE:timestamp} \[%{THREAD_ID:thread_id}\] %{NOTSPACE:log_lvl}\s+%{NOTSPACE:j_class} L\.%{NOTSPACE:j_line} \[%{DATA:j_mdc}\] %{GREEDYDATA:content}" } | ||
} | ||
date { | ||
match => [ "timestamp" , "YYYY-MM-dd HH:mm:ss,SSS", "YYYY-MM-dd HH:mm:ss.SSS" ] | ||
} | ||
mutate { | ||
remove_field => [ "timestamp", "message" ] | ||
# strip => ["content"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
output { | ||
|
||
# ------------------------------ | ||
# ------ Nginx access logs | ||
# ------------------------------ | ||
if [type] == "manon_nginx_access_logs" { | ||
elasticsearch { | ||
hosts => ["elasticsearch:9200"] | ||
index => "manon-nginx-access-%{+YYYY.MM.dd}" | ||
document_type => "manon_nginx_access_logs" | ||
} | ||
|
||
## uncomment to debug, don't use it in production | ||
#stdout { | ||
# codec => "rubydebug" | ||
#} | ||
} | ||
|
||
# ------------------------------ | ||
# ------ Manon logs | ||
# ------------------------------ | ||
if [type] == "manon_app_logs" { | ||
elasticsearch { | ||
hosts => ["elasticsearch:9200"] | ||
index => "manon-app-%{+YYYY.MM.dd}" | ||
document_type => "manon_app_logs" | ||
} | ||
|
||
## uncomment to debug, don't use it in production | ||
#stdout { | ||
# codec => "rubydebug" | ||
#} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters