下面为Logstash的配置文件示例:
input {
file {
path => "/path/to/activemq-artemis.log"
start_position => "beginning"
sincedb_path => "/dev/null"
ignore_older => 0
}
}
filter {
grok {
match => { "message" => "%{DATESTAMP:timestamp} %{LOGLEVEL:log_level} (?(.*)) - (?(.*))" }
add_tag => [ "monitored_log" ]
}
}
output {
elasticsearch {
hosts => [ "localhost:9200" ]
action => "index"
index => "activemq-artemis-%{+YYYY.MM.dd}"
}
if "monitored_log" in [tags] {
stdout {
codec => rubydebug
}
email {
from => "log_monitor@example.com"
to => "admin@example.com"
subject => "Log monitor alert"
via => "smtp"
body => "Logstash has detected an error in activemq-artemis log. Please check the logs for more details."
htmlbody => " Logstash has detected an error in activemq-artemis log. Please check the logs for more details.
"
options => {
address => "mail.smtp.server"
port => "25"
}
}
}
}
下面为Prometheus的配置文件示例:
global:
scrape_interval: 30s
evaluation_interval: