Click or drag to resize

SyslogTarget Class

Sends log messages to Syslog server using either TCP or UDP with format Rfc3164 or Rfc5424
Inheritance Hierarchy
SystemObject
  NLog.TargetsTarget
    NLog.TargetsTargetWithLayout
      NLog.TargetsNetworkTarget
        NLog.TargetsSyslogTarget

Namespace:  NLog.Targets
Assembly:  NLog.Targets.Network (in NLog.Targets.Network.dll) Version: 6.0.0+be83582280f7a841b0d3c6ae75b4f95aaf07e914
Syntax
public class SyslogTarget : NetworkTarget

The SyslogTarget type exposes the following members.

Constructors
  NameDescription
Public methodSyslogTarget
Initializes a new instance of the SyslogTarget class.
Top
Properties
  NameDescription
Public propertyAddress
Gets or sets the network destination address.
(Inherited from NetworkTarget.)
Public propertyCompress
Type of compression for protocol payload. Useful for UDP where datagram max-size is 8192 bytes.
(Inherited from NetworkTarget.)
Public propertyCompressMinBytes
Skip compression when protocol payload is below limit to reduce overhead in cpu-usage and additional headers
(Inherited from NetworkTarget.)
Public propertyConnectionCacheSize
Gets or sets the size of the connection cache (number of connections which are kept alive). Requires KeepConnection =
(Inherited from NetworkTarget.)
Public propertyEncoding
Gets or sets the encoding to be used.
(Inherited from NetworkTarget.)
Public propertyIncludeEventProperties
Gets or sets a value indicating whether LogEvent Properties should be included for StructuredData when Rfc5424 =
Protected propertyIsInitialized
Gets a value indicating whether the target has been initialized.
(Inherited from Target.)
Public propertyKeepAliveTimeSeconds
The number of seconds a connection will remain idle before the first keep-alive probe is sent
(Inherited from NetworkTarget.)
Public propertyKeepConnection
Gets or sets a value indicating whether to keep connection open whenever possible.
(Inherited from NetworkTarget.)
Public propertyLayout
Gets or sets the layout used to format log messages.
(Overrides TargetWithLayoutLayout.)
Public propertyLineEnding
Gets or sets the end of line value if a newline is appended at the end of log message NewLine.
(Inherited from NetworkTarget.)
Protected propertyLoggingConfiguration
Gets the logging configuration this target is part of.
(Inherited from Target.)
Public propertyMaxConnections
Gets or sets the maximum simultaneous connections. Requires KeepConnection = false
(Inherited from NetworkTarget.)
Public propertyMaxMessageSize
Gets or sets the maximum message size in bytes. On limit breach then OnOverflow action is activated.
(Inherited from NetworkTarget.)
Public propertyMaxQueueSize
Gets or sets the maximum queue size for a single connection. Requires KeepConnection =
(Inherited from NetworkTarget.)
Public propertyName
Gets or sets the name of the target.
(Inherited from Target.)
Public propertyNewLine
Gets or sets a value indicating whether to append newline at the end of log message.
(Inherited from NetworkTarget.)
Public propertyNoDelay
Gets or sets whether to disable the delayed ACK timer, and avoid delay of 200 ms.
(Inherited from NetworkTarget.)
Public propertyOnConnectionOverflow
Gets or sets the action that should be taken, when more connections than MaxConnections.
(Inherited from NetworkTarget.)
Public propertyOnOverflow
Gets or sets the action that should be taken if the message is larger than MaxMessageSize
(Inherited from NetworkTarget.)
Public propertyOnQueueOverflow
Gets or sets the action that should be taken, when more pending messages than MaxQueueSize.
(Inherited from NetworkTarget.)
Public propertyRfc3164
Gets or sets a value indicating whether to use RFC 3164 for Syslog Format
Public propertyRfc5424
Gets or sets a value indicating whether to use RFC 5424 for Syslog Format
Public propertySendTimeoutSeconds
The number of seconds a TCP socket send-operation will block before timeout error. Default = 100 secs (0 = wait forever when network cable unplugged and tcp-buffer becomes full).
(Inherited from NetworkTarget.)
Public propertySslCertificateFile
Gets or sets the file path to custom SSL certificate for TCP Socket SSL connections
(Inherited from NetworkTarget.)
Public propertySslCertificatePassword
Gets or sets the password for the custom SSL certificate specified by SslCertificateFile
(Inherited from NetworkTarget.)
Public propertySslProtocols
Gets or sets the SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP.
(Inherited from NetworkTarget.)
Public propertyStructuredDataId
Gets or sets the prefix for StructuredData when Rfc5424 =
Public propertyStructuredDataParams
List of StructuredData Parameters to include when Rfc5424 =
Protected propertySyncRoot
Gets the object which can be used to synchronize asynchronous operations that must rely on the .
(Inherited from Target.)
Public propertySyslogAppName
Name of the device / application / process sending the Syslog-message (Optional)
Public propertySyslogFacility
Device Facility
Public propertySyslogHostName
The FQDN or IPv4 address or IPv6 address or hostname of the sender machine (Optional)
Public propertySyslogLevel
Message Severity
Public propertySyslogMessage
Mesage Payload
Public propertySyslogMessageId
The type of message that should be the same for events with the same semantics. Ex ${event-properties:EventId} (Optional)
Public propertySyslogProcessId
Process Id or Process Name or Logger Name (Optional)
Public propertySyslogTimestamp
Gets or sets a value indicating what DateTime format should be used when Rfc5424 =
Top
Methods
  NameDescription
Protected methodCloseTarget
Closes the target to release any initialized resources
(Inherited from NetworkTarget.)
Public methodDispose
Closes the target.
(Inherited from Target.)
Protected methodDispose(Boolean)
Releases unmanaged and - optionally - managed resources.
(Inherited from Target.)
Public methodFlush
Flush any pending log messages (in case of asynchronous targets).
(Inherited from Target.)
Protected methodFlushAsync
Flush any pending log messages asynchronously (in case of asynchronous targets).
(Inherited from NetworkTarget.)
Protected methodGetBytesToWrite
Gets the payload bytes to be written.
(Inherited from NetworkTarget.)
Protected methodGetHeaderToWrite
Gets the header bytes to be written.
(Overrides NetworkTargetGetHeaderToWrite(LogEventInfo, String, Byte).)
Protected methodInitializeTarget
Initializes the target before writing starts
(Inherited from NetworkTarget.)
Public methodPrecalculateVolatileLayouts
Calls the Precalculate(LogEventInfo) on each volatile layout used by this target. This method won't prerender if all layouts in this target are thread-agnostic.
(Inherited from Target.)
Protected methodRenderLogEvent(Layout, LogEventInfo)
Renders the logevent into a string-result using the provided layout
(Inherited from Target.)
Protected methodRenderLogEventT(LayoutT, LogEventInfo, T)
Renders the logevent into a result-value by using the provided layout
(Inherited from Target.)
Protected methodResolveServiceT
Resolve from DI ServiceRepository
(Inherited from Target.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Target.)
Protected methodWrite(AsyncLogEventInfo)
Sends the rendered logging event over the network optionally concatenating it with a newline character.
(Inherited from NetworkTarget.)
Protected methodWrite(IListAsyncLogEventInfo)
Writes an array of logging events to the log target. By default it iterates on all events and passes them to "Write" method. Inheriting classes can use this method to optimize batch writes.
(Inherited from Target.)
Protected methodWrite(LogEventInfo)
Writes logging event to the target destination
(Inherited from Target.)
Public methodWriteAsyncLogEvent
Writes the log to the target.
(Inherited from Target.)
Public methodWriteAsyncLogEvents(AsyncLogEventInfo)
Writes the array of log events.
(Inherited from Target.)
Public methodWriteAsyncLogEvents(IListAsyncLogEventInfo)
Writes the array of log events.
(Inherited from Target.)
Protected methodWriteAsyncThreadSafe(AsyncLogEventInfo)
Writes a log event to the log target, in a thread safe manner. Any override of this method has to provide their own synchronization mechanism. !WARNING! Custom targets should only override this method if able to provide their own synchronization mechanism. Layout-objects are not guaranteed to be thread-safe, so using them without a SyncRoot-object can be dangerous.
(Inherited from Target.)
Protected methodWriteAsyncThreadSafe(IListAsyncLogEventInfo)
Writes an array of logging events to the log target, in a thread safe manner. Any override of this method has to provide their own synchronization mechanism. !WARNING! Custom targets should only override this method if able to provide their own synchronization mechanism. Layout-objects are not guaranteed to be thread-safe, so using them without a SyncRoot-object can be dangerous.
(Inherited from Target.)
Protected methodWriteFailedNotInitialized
LogEvent is written to target, but target failed to successfully initialize
(Inherited from Target.)
Top
Events
  NameDescription
Public eventLogEventDropped
Occurs when LogEvent has been dropped.
(Inherited from NetworkTarget.)
Top
Remarks
When using TCP then the default message-delimeter is octet-byte-count prefix, but it can be changed by setting LineEnding to LF or NullSee NLog Wiki
See Also