phpList can send logs to Graylog over GELF (Graylog Extended
Log Format) using Monolog's gelf handler. The handler ships disabled by default
in both environments.
- In
config/config_prod.yml, uncomment thegrayloghandler undermonolog.handlers. It sendserror-level and above logs, using thegraylog_hostandgraylog_portparameters fromconfig/parameters.yml(defaults:graylog.phplist.local:12201). - In
config/config_dev.yml, uncomment thegrayloghandler to also log in development. It sends every level except theeventchannel. - Update
graylog_hostandgraylog_portinconfig/parameters.ymlto point at your Graylog server.
# config/parameters.yml
parameters:
graylog_host: 'graylog.example.com'
graylog_port: 12201Your Graylog server needs a GELF UDP input to receive these logs:
- In the Graylog web interface, go to System > Inputs.
- Select "GELF UDP" and click "Launch new input".
- Configure it with:
- Title: phpList Core
- Bind address:
0.0.0.0(listen on all interfaces) - Port:
12201(or whatever you set asgraylog_port)
- Click "Save".
- Trigger a log message in the application (e.g. an error).
- Check the Graylog web interface for the message.
- If nothing shows up, see Troubleshooting below.
If logs aren't appearing in Graylog:
- Confirm the
grayloghandler is uncommented in the config for the environment you're testing. - Verify the Graylog server is running and reachable from the application server.
- Check that the GELF UDP input is running and bound to the port you configured.
- Check for firewall rules blocking UDP traffic on that port.