Bug 239385 - syslog: make it posible to have "." in app_name
Summary: syslog: make it posible to have "." in app_name
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.4-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Keywords: patch
Depends on:
Reported: 2019-07-22 20:23 UTC by John D.
Modified: 2020-06-26 05:53 UTC (History)
1 user (show)

See Also:

syslogd path for stable/11 to fix problem with '.' in ident (402 bytes, patch)
2020-06-25 18:10 UTC, John D.
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John D. 2019-07-22 20:23:05 UTC
App_name field in current syslog message parsed with this code:
----- >8 -------
	app_name_length = strspn(m,
---- >8 --------
What if it will look like that:
----- >8 -------
	app_name_length = strspn(m,
---- >8 -------- 
to have something like `com.example.myprog[1234]` as valid identity?
Comment 1 Mark Johnston freebsd_committer 2020-06-16 19:20:43 UTC
I think this is not unreasonable.  RFC 3164 states that the app name should be an alphanumeric string, but we already handle other characters.  RFC 5424 explicitly does not place any restrictions on app-name.

If you are willing to write a patch for this I would be willing to review.
Comment 2 John D. 2020-06-16 19:41:56 UTC
OK. I try to do patch for this. Thanks
Comment 3 John D. 2020-06-25 18:10:59 UTC
Created attachment 215942 [details]
syslogd path for stable/11 to fix problem with '.' in ident


stable/11 - reproduced
stable/12 - not reproduсed
current   - not reproduсed

Look like problem take place only in stable/11 and it's derivatives (since 11.3 I think). Does it make sense to fix it?

I attach patch, help to resolve problem for me.


1. Add to `/etc/syslog.conf`:
   ----- 8< -------
   *.*   /var/log/t1
   ----- 8< -------
2. Make log file `/var/log/t1`
3. Reload syslogd
4. Run: `logger -t test.some "1"`

Without patch message will be append to `/var/log/message`, with patch to `/var/log/t1`