On Thu, 29 Jul 2021 22:48:40 +0000 (UTC)
Jim Pennino <firstname.lastname@example.org
> On Thursday, July 29, 2021, 3:40:41 PM PDT, Gary E. Miller
> Yo Jim!
> I checked the code on this:
> gpsd/gpsd.c: openlog("gpsd", LOG_PID, LOG_USER);
> So gpsd logs to "ident" "gpsd". See "man 3 syslog".
> Yes it does, to the facility LOG_USER.
> Yet another undocumented feature that it would be nice to know by the
> end users.
It should be obvious just from looking at the logs. We assume basic
sysadmin skills here. I just added this to the gpsd man page.
No, you can not tell from any syslog log file what the facility or priority is unless the logging program explicitly does so in the generated message.
man 3 syslog
void openlog(const char *ident, int option, int facility);
void syslog(int priority, const char *format, ...);
Note that openlog specifies the facility to log to and syslog specifies the priority. Neither of those are written to the syslog log file. If you want to do that you have to explicitly put that in the string you pass as the second argument to syslog(), i.e. the message to log, but I have never heard of anyone doing that though it is common to put things like WARNING or FAILED in the string.
What determines what get written where is in the syslog configuration file. A line like:
Says send everything with a facility of LOG_LPR, a facility of LOG_KERN with a priority greater than or equal to LOG_ERR, and a facility of LOG_DAEMON with a priority greater than or equal to LOG_WARN, to the file /var/log/crap. And yes, syslog configuration files on most Linux distros can also filter on the ident.
That is basic programming and sysadmin skills.