Logging to /dev/log should follow recommended Syslog format: app-name not specified
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description of Issue/Question
log_file can be set to log to syslog, but does not specify the app-name field.
As a result, messages are wrongly parsed and part of the timestamp is used for the app-name, truncating the timestamp field.
For instance, with a typical rsyslog template like this:
template(name="template_plain" type="list") {
constant(value="{")
constant(value="\",\"app-name\":\"") property(name="app-name" format="json")
constant(value="\",\"message\":\"") property(name="msg" format="json")
constant(value="\"}")
}
one gets:
{"app-name": "2017-03-06","message":"19:00:20,369 [salt.utils.parsers][WARNING ][14365] Master received a SIGTERM. Exiting."}
Could the app-name field precise if the logs come from salt-minion or salt-master?
Steps to Reproduce Issue
Logging to /dev/log and asking rsyslog to output app-name and msg:
# cat /etc/salt/master.d/log_file.conf
log_file: file:///dev/log/LOG_LOCAL0
# cat /etc/salt/minion.d/log_file.conf
log_file: file:///dev/log/LOG_LOCAL0
Versions Report
salt --versions-report
Salt Version:
Salt: 2016.11.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.4.2
gitdb: 0.6.4
gitpython: 1.0.1
ioflo: Not Installed
Jinja2: 2.8
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 1.0.3
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
python-gnupg: 0.3.8
PyYAML: 3.11
PyZMQ: 15.2.0
RAET: Not Installed
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: Ubuntu 16.04 xenial
machine: x86_64
release: 4.4.0-59-generic
system: Linux
version: Ubuntu 16.04 xenial
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the provided master and minion log_file configurations, then trace Salt's syslog logging path to find where the app-name is set. Verify the result through rsyslog's app-name and message output, and consider the issue done when salt-master and salt-minion logs identify their sources without truncating the timestamp.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, python
- Domain
- observability, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100