Add setting for pretty printing violoation reports in the log

Created on 26 June 2023, over 1 year ago
Updated 4 July 2024, 5 months ago

Problem/Motivation

Using JSON_PRETTY_PRINT for CSP violations results in a new log entry in the syslog for each line of report data.

Steps to reproduce

Activate the module and use syslog for log system.

Proposed resolution

Create a settings to either activate or not the pretty print.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡·Greece smavri

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @smavri
  • πŸ‡¬πŸ‡·Greece smavri

    here is a patch

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    There is a php config "syslog.filter" to determine if syslog splits the log message into multiple entries at new lines. By default, the logged string will be split at newline characters, and any non-printable characters will be escaped.

  • πŸ‡¨πŸ‡¦Canada gapple

    @mfb thanks for the info

    Looks like this was changed behaviour in PHP 7.3, to default to splitting messages on newlines with the no-ctrl option (pre-7.3 behaviour can be configured with the raw option)
    https://www.php.net/manual/en/errorfunc.configuration.php#ini.syslog.filter

    CSP could detect the logging service and ini option to avoid pretty printing for syslog, but that seems like it could be better as an upstream option on the syslog service to strip newlines? AFAIK it's not uncommon for modules to send strings with newline to the logger, particularly with pre formatting?

    (as a sidenote, the goal is to remove logging violations from CSP module, and recommend the Reporting API β†’ module with logging to the database by default once that functionality is available)

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Yes πŸ“Œ Sort out @backtrace_string logging by Syslog module Active is related; I'd agree that syslog module should somehow improve handling of multi-line log messages, especially since core can log those multi-line backtraces

  • Status changed to Closed: outdated 5 months ago
  • πŸ‡¨πŸ‡¦Canada gapple

    The sitelog report handler is deprecated in 1.x and removed from 2.x.

    Reporting API module is the suggested replacement, but will also be changing from using the sitelog to storing reports in it's own database table in a future version.

Production build 0.71.5 2024