Skip to content

Logging to /dev/log should follow recommended Syslog format: app-name not specified #39861

@ealphonse

Description

@ealphonse

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConfirmedSalt engineer has confirmed bug/feature - often including a MCVEPlatformRelates to OS, containers, platform-based utilities like FS, system based appsbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions