# Filtering Syslog Messages

> Section in “New and Extended Functionality › Cryptography and Security” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/cryptography-and-security/filtering-syslog-messages/>

The `syslog()` function can be used to generate a log message that will be then processed by the operating system’s logger. A new configuration option, `syslog.filter`, was introduced in PHP 7.3 for optionally filtering these messages before they are passed on to the operating system’s logger:

- `syslog.filter=no-ctrl` (default) passes messages after removing all control characters
- `syslog.filter=ascii` passes messages after removing all characters that are not printable ASCII characters or newlines
- `syslog.filter=all` passes messages unchanged but splitting them at newlines
- `syslog.filter=raw` passes messages unchanged and without splitting them at newlines

Depending on how your operating system’s logger processes messages sent by PHP, appropriate filtering must be configured. Otherwise messages may become useless at best or a security risk at worst.

---

Previous: [Cryptographically Secure Pseudo-Random Number Generator (CSPRNG)](https://php7explained.com/new-and-extended-functionality/cryptography-and-security/cryptographically-secure-pseudo-random-number-generator-csprng/index.html.md) | Next: [Same-Site Cookies](https://php7explained.com/new-and-extended-functionality/cryptography-and-security/same-site-cookies/index.html.md)
