https://www.cnblogs.com/fengjian2016/p/13356125.html
https://www.bboy.app/2020/07/08/%E4%BD%BF%E7%94%A8loki%E8%BF%9B%E8%A1%8C%E6%97%A5%E5%BF%97%E6%94%B6%E9%9B%86/

tomcat多行日志合并

https://www.ngui.cc/51cto/show-602779.html

https://grafana.com/docs/loki/latest/clients/promtail/stages/regex/

  1. [root@tomcat01 promtail]# cat config.yaml
  2. ## https://www.cnblogs.com/fsckzy/p/13231696.html
  3. # Promtail Server Config
  4. server:
  5. http_listen_port: 9080
  6. grpc_listen_port: 0
  7. # Positions
  8. positions:
  9. filename: /tmp/positions.yaml
  10. # Loki服务器的地址
  11. clients:
  12. - url: http://192.168.130.155:3100/loki/api/v1/push
  13. scrape_configs:
  14. - job_name: xxx-tomcat
  15. static_configs:
  16. - targets:
  17. - tomcat
  18. labels:
  19. job: xxx-wx-msg
  20. host: xxx-tomcat01
  21. filename: wx-msg.log
  22. __path__: /xxx/wx-msg/wx-msg.log
  23. pipeline_stages:
  24. - match:
  25. selector: '{host="xxx-tomcat01"}'
  26. stages:
  27. # https://grafana.com/docs/loki/latest/clients/promtail/stages/regex/
  28. - regex:
  29. expression: '.*'
  30. multiline:
  31. firstline: '^202'