Syslog

SyslogPro~ Syslog

A class to work with syslog messages using UDP, TCP, or TLS transport. There is support for Syslog message formatting RFC-3164, RFC-5424 including Structured Data, IBM LEEF (Log Event Extended Format), and HP CEF (Common Event Format). Syslog formatting classes can be used as input into a Syslog class to be used simultaneously to the same Syslog server. *

Constructor

new Syslog(optionsopt)

Source:
Version:
  • 0.0.0
Since:
  • 0.0.0
Construct a new Syslog transport object with user options
Parameters:
Name Type Attributes Description
options object <optional>
Options object >>>Transport Configuration
Properties
Name Type Attributes Default Description
target string <optional>
'localhost' The IP Address|FQDN of the Syslog Server, this option if set will take presidents over any target set in a formatting object
protocol string <optional>
'udp' L4 transport protocol (udp|tcp|tls), this option if set will take presidents over any transport set in a formatting object
port number <optional>
514 IP port, this option if set will take presidents over any IP Port set in a formatting object
tcpTimeout number <optional>
10000 Ignored for all other transports, this option if set will take presidents over any timeout set in a formatting object
tlsServerCerts Array.<string> <optional>
Array of authorized TLS server certificates file locations, this option if set will take presidents over any certificates set in a formatting object
tlsClientCert string <optional>
Client TLS certificate file location that this client should use, this option if set will take presidents over any certificates set in a formatting object
tlsClientKey string <optional>
Client TLS key file location that this client should use, this option if set will take presidents over any certificates set in a formatting object >>>Syslog Format Settings
format string <optional>
'none' Valid syslog format options for this module are 'none', 'rfc3164', 'rfc5424', 'leef', 'cef'
rfc5424 RFC3164 <optional>
RFC5424 related settings
rfc5424 RFC5424 <optional>
RFC5424 related settings
leef LEEF <optional>
IBM LEEF (Log Event Extended Format) object
cef CEF <optional>
HP CEF (Common Event Format) formatting object
Requires:
  • module:moment

Requires

  • module:moment

Members

cef :CEF

Source:
Type:
  • CEF

format :string

Source:
Type:
  • string

leef :LEEF

Source:
Type:
  • LEEF

port :number

Source:
Type:
  • number

protocol :string

Source:
Type:
  • string

rfc3164 :RFC3164

Source:
Type:
  • RFC3164

rfc5424 :RFC5424

Source:
Type:
  • RFC5424

target :string

Source:
Type:
  • string

tcpTimeout :number

Source:
Type:
  • number

tlsClientCert :string

Source:
Type:
  • string

tlsClientKey :string

Source:
Type:
  • string

tlsServerCerts :Array.<string>

Source:
Type:
  • Array.<string>

(private) tlsServerCerts

Source:

Methods

(private) addTlsServerCerts(certs) → {Promise}

Source:
Version:
  • 0.0.0
Since:
  • 0.0.0
Add a TLS server certificate which can be used to authenticate the server this syslog client is connecting too. This function will validate the input as a file location string and add it to an array of certificates
Parameters:
Name Type Description
certs string | Array.<string> File location of the certificate(s)
Throws:
- A Type Error
Type
Error
Returns:
- True
Type
Promise

(private) send(msg) → {Promise}

Source:
Send the Syslog message to the selected target Syslog server using the selected transport.
Parameters:
Name Type Description
msg string The formatted Syslog Message
Throws:
  • - Timeout error for TCP and TLS connections
    Type
    Error
  • - Network Error
    Type
    Error
Returns:
- The Syslog formatted string sent
Type
Promise

(private) tcpMessage(msg) → {Promise}

Source:
Send the Syslog message over TCP
Parameters:
Name Type Description
msg string The formatted Syslog Message
Throws:
  • - Timeout error for TCP and TLS connections
    Type
    Error
  • - Network Error
    Type
    Error
Returns:
- The Syslog formatted string sent
Type
Promise

(private) tlsMessage(msg) → {Promise}

Source:
Send the Syslog message over TLS
Parameters:
Name Type Description
msg string The formatted Syslog Message
Throws:
  • - Timeout error for TCP and TLS connections
    Type
    Error
  • - Network Error
    Type
    Error
Returns:
- The Syslog formatted string sent
Type
Promise

(private) udpMessage(msg) → {Promise}

Source:
Send the Syslog message over UDP
Parameters:
Name Type Description
msg string The formatted Syslog Message
Throws:
- Network Error
Type
Error
Returns:
- The Syslog formatted string sent
Type
Promise