28 lines
816 B
Plaintext
28 lines
816 B
Plaintext
input {
|
|
file {
|
|
path => "[SpringSide Dir]\examples\showcase\logs\showcase.log" # logstash要求必须是绝对路径
|
|
type => "showcase"
|
|
codec => multiline { # 将Exception Stacktrace拼接成一条日志记录
|
|
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s*Caused by:.+)"|(^\s+... \d+ common frames omitted)
|
|
what => "previous"
|
|
}
|
|
start_position => "beginning"
|
|
}
|
|
}
|
|
|
|
filter {
|
|
if [type] != "showcase" or [message] !~ /(ERROR)|(^.+Exception: .+)/{
|
|
drop {} # 将非错误日志过滤掉
|
|
}
|
|
}
|
|
|
|
output {
|
|
tcp {
|
|
host => "127.0.0.1"
|
|
port => 6868
|
|
codec => plain {
|
|
format => "[%{host}]-%{message}" # 设置output的格式,输出HostName + Message内容本身
|
|
}
|
|
}
|
|
}
|