<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel rdf:about="https://dwt.life/feed/rss/tag/log/">
<title>dwt&#039;s life - log</title>
<link>https://dwt.life/tag/log/</link>
<description></description>
<items>
<rdf:Seq>
<rdf:li resource="https://dwt.life/archives/189/"/>
</rdf:Seq>
</items>
</channel>
<item rdf:about="https://dwt.life/archives/189/">
<title>filebeat+logstash钉钉监控PHP错误日志报警</title>
<link>https://dwt.life/archives/189/</link>
<dc:date>2022-02-02T02:29:00+08:00</dc:date>
<description>PHP的错误日志样式[2021-03-05T00:04:12+08:00] 175.167.136.244 POST api.51cto.cn/User/getUserInfo
[ error ] [10]nologin[/var/www/html/api/application/common/controllers/BaseController.php:239]下载filebeat-7.10.2filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /data/error/*.log
  multiline.pattern: &#039;^\[\d{4}\-\d{2}\-\d{2}&#039;
  multiline.negate: true
  multiline.match: after
- type: filestream
  enabled: false
  paths:
    - /var/log/*.log
filebeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false
setup.template.settings:
  index.number_of_shards: 1
setup.kibana:
output.logstash:
  hosts: [&quot;192.168.0.1:5044&quot;]
processors:
  - add_host_metadata:
      when.not.contains.tags: forwarded
  - add_cloud_metadata: ~
  - add_docker_metadata: ~
  - add_kubernetes_metadata: ~logstash我用的docker创建文件/data/logstash/conf/logstash.ymlhttp.host: &quot;0.0.0.0&quot;/data/logstash/pipeline/logstash.confinput {
  beats {
    port =&gt; 5044
  }
}
filter {
    if &quot;Allowed memory size&quot; in [message]{
        drop{}
     }
    if &quot;Maximum execution time&quot; in [message] {
        drop{}
     }
}
output {

  http {
    http_method =&gt; &quot;post&quot;
    url =&gt; &quot;http://api.xxx.cn/api/dingtalk/send&quot;
    format =&gt; &quot;json&quot;   #如果是表单就是form
    mapping =&gt; {
      &quot;access_token&quot; =&gt; &quot;297873a03c25bc202bf1264ca0e101847aed213213132131321&quot;
      &quot;msg_type&quot; =&gt; &quot;text&quot;
      &quot;content&quot; =&gt; &quot;报警: %{message}&quot;
    }
    }
}启动dockerdocker run -d -p 5044:5044 -p 9600:9600 -v /data/logstash/conf/logstash.yml:/usr/share/logstash/config/logstash.yml -v /data/logstash/pipeline:/usr/share/logstash/pipeline --restart=always logstash:7.10.1来源：https://blog.51cto.com/fengwan/2678093</description>
</item>
</rdf:RDF>