[로그통합]JBOSS parsing
03.APPLICATION =============/03.로그통합 / 2013. 5. 20. 18:23
http://viriya.ca/2012/08/centralized-logging-for-oracle-fusion/
I am using the file input to tail the log that already exists. An entry in the log file is in this format:
2012-05-18 10:26:01,434 INFO [com.xxxx.xxxx.server.singleton.ConnectionHASingleton] Summary (PSW Bucket: 1) 1 current(22ms), 0 shared(0ms), 0 static(0ms), 0 health(0ms) Total elapsed 26ms
I'm finding that the Severity in graylog2 is always 'Alert'. I'm using the following config file with the multiline, grok and mutate filters:
input {
# Tail the JBoss server.log file
file {
type => "log4j"
path => "/JBoss/server/all/log/server.log"
}
}
filter {
multiline {
type => "log4j"
pattern => "^\\s"
what => "previous"
}
grok {
type => "log4j"
pattern => "%{DATESTAMP:timestamp} %{WORD:severity} %{GREEDYDATA:message}"
}
mutate {
type => "log4j"
replace => [ "@message", "%{message}" ]
}
}
output {
# Emit events to stdout for easy debugging of what is going through logstash
stdout {
debug => true
}
# Send Jboss log to graylog2
gelf {
facility => "jboss"
host => "log01"
}
}
Here's the logstash debug output for this log entry:
{
"@source" => "file://stg-app01//JBoss/server/all/log/server.log",
"@type" => "log4j",
"@tags" => [],
"@fields" => {
"timestamp" => [
[0] "2012-05-18 10:26:01,434"
],
"severity" => [
[0] "INFO"
],
"message" => [
[0] " [com.xxxx.xxxx.server.singleton.ConnectionHASingleton] Summary (PSW Bucket: 1) 1 current(22ms), 0 shared(0ms), 0 static(0ms), 0 health(0ms) Total elapsed 26ms"
]
},
"@timestamp" => "2012-05-18T10:26:01.601000Z",
"@source_host" => "stg-app01",
"@source_path" => "//JBoss/server/all/log/server.log",
"@message" => " [com.xxxx.xxxx.server.singleton.ConnectionHASingleton] Summary (PSW Bucket: 1) 1 current(22ms), 0 shared(0ms), 0 static(0ms), 0 health(0ms) Total elapsed 26ms"
}
Finally, here's how graylog2 sees this entry:
From: stg-app01
Date: 2012-05-18 10:26:31 +0000
Severity: Alert
Facility: jboss
File: //JBoss/server/all/log/server.log:151
timestamp: 2012-05-18 10:26:01,434
severity: INFO
message: [com.xxxx.xxxx.server.singleton.ConnectionHASingleton] Summary (PSW Bucket: 1) 1 current(22ms), 0 shared(0ms), 0 static(0ms), 0 health(0ms) Total elapsed 26ms
Full message:
[com.xxxx.xxxx.server.singleton.ConnectionHASingleton] Summary (PSW Bucket: 1) 1 current(22ms), 0 shared(0ms), 0 static(0ms), 0 health(0ms) Total elapsed 26ms
It has two severity entries. Am I doing something wrong?
Have a look at the "level" flag in your output configuration. In your
case you'll want to change the naming in grok to something like
"jboss_severity" and then use this in your output:
gelf {
level => [%{severity}, %{jboss_severity}]
# rest of config
}
'03.APPLICATION ============= > 03.로그통합' 카테고리의 다른 글
[로그통합]로그 파싱 관련 (0) | 2013.05.21 |
---|---|
[로그통합]Weblogic logs using Logstash and Graylog2 (0) | 2013.05.20 |
[로그통합]logstash + graylog2 (0) | 2013.05.20 |
[로그통합]Graylog2 & MongDB & Elasticsearch (0) | 2013.05.02 |