Syslog module doesn't escape quotes in message string for syslog

Created on 10 May 2023, over 1 year ago

Problem/Motivation

For Syslog pretty often the format used is "logfmt", so instead of the default format that we have:

!base_url|!timestamp|!type|!ip|!request_uri|!referer|!uid|!link|!message

people use this one:

base_url="!base_url" timestamp="!timestamp" type="!type" ip="!ip" request_uri="!request_uri" referer="!referer" uid="!uid" link="!link" message="!message"

But this format breaks if the message contains the " symbol. For example, this happens on a node save event with a title that includes quotes.

The same problem can appear also with the default format if the "message" got | symbol.

Steps to reproduce

1. Configure the "logfmt" format of syslog record:

base_url="!base_url" timestamp="!timestamp" type="!type" ip="!ip" request_uri="!request_uri" referer="!referer" uid="!uid" link="!link" message="!message"

2. Save a node with a title that includes quotes, like this: Hello "world"! | "Aloha!.

3. Try to parse the string using the "logfmt" format.

Proposed resolution

Add an option "Add slashes" that will call the "addslashes" function for the message text.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.1

Component
Syslog 

Last updated about 1 month ago

Created by

🇦🇲Armenia Murz Yerevan, Armenia

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

Comments & Activities

Production build 0.71.5 2024