docs: def parseSyslog(msg):
      """Parses Syslog messages (RFC 5424)
  
      The `Syslog Message Format (RFC 5424)
      <https://tools.ietf.org/html/rfc5424#section-6>`_ can be parsed with
      simple whitespace tokenization::
  
          SYSLOG-MSG = HEADER SP STRUCTURED-DATA [SP MSG]
          HEADER     = PRI VERSION SP TIMESTAMP SP HOSTNAME
                       SP APP-NAME SP PROCID SP MSGID
          ...
          NILVALUE   = "-"
  
      This method does not return STRUCTURED-DATA.  It parses NILVALUE
      ("-") STRUCTURED-DATA or simple STRUCTURED-DATA which does not
      contain (escaped) ']'.
  
      :returns: A dictionary keyed by the constituent parts of the
      Syslog message.
      """
      tokens = msg.split(' ', 6)
      result = { }
  
      if len(tokens) > 0:
          pri   = tokens[0]
          start = pri.find('<')
          stop  = pri.find('>')
  
          if start != -1 and stop != -1:
              result['pri'] = pri[start + 1:stop]
          else:
              result['pri'] = ''
  
          if stop != -1 and len(pri) > stop:
              result['version'] = pri[stop + 1:]
          else:
              result['version'] = ''
  
      result[ 'timestamp' ] = tokens[1] if len(tokens) > 1 else ''
      result[ 'hostname'  ] = tokens[2] if len(tokens) > 2 else ''
      result[ 'appname'   ] = tokens[3] if len(tokens) > 3 else ''
      result[ 'procid'    ] = tokens[4] if len(tokens) > 4 else ''
      result[ 'msgid'     ] = tokens[5] if len(tokens) > 5 else ''
      result[ 'msg'       ] = ''
  
      if len(tokens) > 6:
          # The following will work for NILVALUE STRUCTURED-DATA or
          # simple STRUCTURED-DATA which does not contain ']'.
          rest  = tokens[6]
          start = rest.find('-')
  
          if start == -1:
              start = rest.find(']')
  
          if len(rest) > start:
              result['msg'] = rest[start + 1:].strip()
  
      return result