TIdSysLogMessage
TIdSysLogMessage encapsulates a Syslog (RFC 3164) message.
Unit
Description
TIdSysLogMessage encapsulates a Syslog (RFC 3164) message for the
TIdSysLog and TIdSysLogServer components including the ability to encode and decode the SysLog message.
This property indicates the general area where the SysLog message was generated from.
property Facility: TidSyslogFacility;
Description
This property indicates the general area where the SysLog message was generated from. Setting this property will update the
TIdSysLogMessage.Pri property as appropriate.
IP address or host name for the computer sending the message.
property Hostname: string;
Description
Hostname is a string property that represents the IP address or host name for the computer sending the message. By default, this is set the IP address of the user's computer and is obtained by using GStack.LocalAddress.
Note: This property is not stored in the DFM because the HostName property is specific to a user's computers and storing it in the form files could create a wrong value in the System log.
This property contains the text and process information of the
TIdSysLogMessage.
Description
Description
Peer is a String property that represents the IP address or hostname for the peer that sent the
TIdSysLogMessage to the TIdSysLogServer.
Description
Raw contents of the message as read from the
socket connection.
property RawMessage: string;
Description
RawMessage is a String property that represents the raw contents of the Syslog message as read from the
socket connection. RawMessage contains the values parsed to determine the contents of the
Hostname,
TimeStamp,
Facility,
Severity,
Pri, and
Msg properties.
This property indicates the severity of the SysLog message.
Description
This property indicates the severity of the SysLog message. Setting this property will update the
TIdSysLogMessage.Pri property as appropriate.
Date and time that the message was sent.
property TimeStamp: TDateTime;
Description
TimeStamp is a TDateTime property that represents the date and time that a Syslog message was sent. TimeStamp is the value read from the header portion of the Syslog message. If an exception occurs while parsing the message header, TimeStamp will contain the current date and time.
Copies property values from a persistent source.
procedure assign(Source: TPersistent); override;
Description
Assign is a procedure that allows property values for the current object instance to be copied from the persistent component specified in Source. When Source is an instance of
TIdSysLogMessage, the values for the
Pri,
Msg, HostName and Timestamp properties are updated from the values in Source. Otherwise, the inherited Assign method is called.
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Create calls the inherited Create method using AOwner as the owner of the component instance. Create sets the default value for the PRI property to 13, and uses the global
TIdStack instance in
GStack to retrieve the value for the HostName property. Create also allocates the
TIdSysLogMsgPart used to represent the
Msg property.
Frees the object instance.
destructor Destroy; override;
Description
Destroy is the destructor for the object instance. Destroy frees resources allocated in
Create for the
Msg property prior to calling the inherited Destroy method.
EncodeMessage encodes the SysLog message into a form for sending with a
TIdSysLog component.
function EncodeMessage: String; virtual;
Description
EncodeMessage encodes the SysLog message into a form for sending with a
TIdSysLog component.
This message reads a SysLog message from stream.
procedure ReadFromStream(Src: TStream; Size: integer; APeer: String); virtual;
Parameters
Src: TStream
The stream to read the SysLog message from
Size: integer
The size of the data to read
APeer: String
Description
This message reads a SysLog message from stream and sets the
TIdSysLogMessage as required. This method is usually called by the TIdSysLogServer before calling the TIdSysLogServer.OnSyslog event handler.
Sends the Syslog message to the host specified host.
procedure SendToHost(const Dest: String);
Parameters
const Dest: String
Host name or IP address to receive the syslog message.
Description
SendToHost is public procedure used to
send the Syslog message to the host name or IP address indicated in Dest. SendToHost will create a temporary
TIdUDPClient instance, when one has nopt already been assigned, to be used to for the transmission to the Syslog daemon in Dest. SendtoHost call
TIdUDPClient.Send using Dest and
IdPORT_syslog as the destintination for the contents of the message created using
EncodeMessage.