Files
gochat/configs/fluentd.conf
T
2026-06-04 15:44:48 +08:00

66 lines
1.3 KiB
Plaintext

# GoChat Fluentd Configuration
# Reference: Chatwoot production uses structured JSON logging
# This config collects logs from gochat containers and forwards to outputs
<source>
@type tail
path /var/log/gochat/*.log
pos_file /var/log/fluentd/gochat.log.pos
tag gochat.app
<parse>
@type json
time_key timestamp
time_format %Y-%m-%dT%H:%M:%S.%NZ
keep_time_key true
</parse>
</source>
<source>
@type tail
path /var/log/gochat/worker.log
pos_file /var/log/fluentd/gochat-worker.log.pos
tag gochat.worker
<parse>
@type json
time_key timestamp
time_format %Y-%m-%dT%H:%M:%S.%NZ
keep_time_key true
</parse>
</source>
# Docker container logs via systemd/journald
<source>
@type systemd
filters [{ "_COMM": "docker" }]
tag docker
</source>
# ---- Outputs ----
# Console output for development
<match gochat.**>
@type stdout
</match>
# Production: send to Elasticsearch or Loki
# Uncomment based on your backend:
#
# <match gochat.**>
# @type elasticsearch
# host elasticsearch
# port 9200
# logstash_format true
# logstash_prefix gochat
# <buffer>
# @type file
# path /var/log/fluentd/buffers/gochat
# flush_interval 5s
# </buffer>
# </match>
#
# <match gochat.**>
# @type loki
# url http://loki:3100
# labels { "app": "gochat", "environment": "production" }
# </match>