I have recently configured a ELK server,
In my app server (magento) var/log/ directory has many log files (including some 3rd party extension logs for magento), So I thought of sending all using *.log to logstash, because we are not aware of some of the log file names that might create in future because of 3rd party integration. and we need to catch those also.
Magento exception log has a multi-line logs with the stack trace, So What i did was add a filter using gork, Now It seems working (giving the concatenate output),
Since I have one define type "staging-all-lincraft-logs" (in both config) all the log files are parsing through it (see the below code),
I can't remove the *.log and give specific names sine un-aware of file names
Is there any way I can parse only the specific files(exception.log and system.log) in logstash config (I tried with adding the parth,It does not work)
logstash forwarder config:
"files": [
{
"paths": [
"/home/deploy/lindcraft/current/codepool/var/log/*.log"
],
"fields": { "type": "staging-all-lincraft-logs" }
}
]
logstash filter config:
filter {
if [type] == "staging-all-lincraft-logs" {
multiline{
# path => "/home/deploy/lindcraft/current/codepool/var/log/exception.log"
pattern => "^%{TIMESTAMP_ISO8601:timestamp}"
what => "previous"
negate=> true
}
grok {
match => [
"message",
"(?m)%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:priority_name} \(%{INT:priority_level}\): %{GREEDYDATA:message}"
]
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
overwrite => [ "message" ]
}
date {
match => [ "timestamp", "ISO8601" ]
}
}
}