#325 增加Logstash从业务日志进行统计的演示
This commit is contained in:
@@ -2,5 +2,4 @@ jmeter/*.jtl
|
||||
jmeter/*.log
|
||||
local-script/
|
||||
logstash/logstash-*-flatjar.jar
|
||||
logstash/*/shipper.conf
|
||||
logstash/*/data
|
||||
|
||||
@@ -6,13 +6,13 @@ input {
|
||||
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s*Caused by:.+)|(^\s+... \d+ common frames omitted)"
|
||||
what => "previous"
|
||||
}
|
||||
start_position => "beginning"
|
||||
start_position => "beginning"
|
||||
}
|
||||
}
|
||||
|
||||
filter {
|
||||
if [message] !~ /(ERROR)|(^.+Exception: .+)/{ # 将非错误日志过滤掉
|
||||
drop {}
|
||||
if [message] !~ /(ERROR)|(^.+Exception: .+)/{ # 将非错误日志过滤掉
|
||||
drop {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
java -jar ../logstash-*.jar agent -f shipper.conf
|
||||
|
||||
pause;
|
||||
@@ -0,0 +1,36 @@
|
||||
input {
|
||||
file {
|
||||
path => "C:\tmp\logs\business.log" # logstash要求必须是绝对路径
|
||||
type => "business"
|
||||
}
|
||||
}
|
||||
|
||||
filter {
|
||||
if [type] == "business" {
|
||||
metrics {
|
||||
meter => "business-events"
|
||||
clear_interval => 10
|
||||
flush_interval => 10
|
||||
rates => []
|
||||
add_tag => "business-metric"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output {
|
||||
if "business-metric" in [tags] {
|
||||
stdout {
|
||||
debug => true
|
||||
}
|
||||
graphite {
|
||||
host => "localhost"
|
||||
port => 2003
|
||||
debug => true
|
||||
metrics => ["showcase.business-events","%{business-events.count}"]
|
||||
}
|
||||
} else {
|
||||
stdout {
|
||||
debug => false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user