The Kiwi Logger COM object (KLOG_COM.dll) is designed for use with VB, ASP, Windows Scripting Host (ie. VBScript) and any other language that supports COM.
Name: Klog_COM.DLL
Purpose: To provide basic UDP syslog message sending capabilities via a COM DLL with minimum dependencies
Works with: VB, VBScript, ASP etc.
Dependencies: MSWINSCK.OCX, MSVBVM60.DLL
Properties:
RemoteAddress(strRemoteAddress As String)
RemotePort(lngRemotePort As Long)
FacilityName(strFacilityName As String)
FacilityNumber(lngFacilityNumber As Long)
LevelName(strLevelName As String)
LevelNumber(lngLevelNumber As Long)
PriorityNumber(lngPriorityNumber As Long)
MessageText(strMessageText As String)
UseRFC(blnUseRFC As Boolean)
UseFile(blnUseFile As Boolean)
FileName(strFileName As String)
UseUTF8(blnUseUTF8 As Boolean)
Error_Data(strError_Data As String)
Methods:
Function SendMessage(Optional sRAddress As String, Optional lRPort As Long, _
Optional vFac As Variant, Optional vLev As Variant, _
Optional sMText As String, Optional bRFC As Boolean, _
Optional bFile As Boolean, Optional sFile As String, _
Optional bUFT8 As Boolean) As Boolean
Function UTF8_Encode(strUnicode As String) As Byte()
Function FileWrite(fName As String, fData As String) As Boolean
VBScript Example:
Option Explicit
Dim oSysSender
' Create the Syslog Sender object
Set oSysSender = CreateObject("Klog_COM.SyslogSender")
' Set the properties
oSysSender.FacilityName = "local7" ' Local7 Facility
oSysSender.LevelName = "info" ' Info level
oSysSender.RemoteAddress = "127.0.0.1" ' Send to local host
oSysSender.RemotePort = "514" ' Use the standard UDP Syslog port
oSysSender.UseFile = False ' Send via UDP
oSysSender.UseRFC = False ' Don't use the RFC3164 format
oSysSender.UseUTF8 = True ' Encode the data as UTF8.
oSysSender.MessageText = "This is a test message send from KlogX.DLL"
' Now send the message
Dim RetVal
RetVal = oSysSender.SendMessage()
' Notify if message was sent successfully
If RetVal = True then
MsgBox "Message sent successfully"
Else
MsgBox "Message was not sent successfully. Error: " & oSysSender.Error_Data
End if
' Destroy the object
Set oSysSender = Nothing
ASP Example:
Dim oSysSender
' Create the Syslog Sender object
Set oSysSender = CreateObject("Klog_COM.SyslogSender")
' Set the properties
oSysSender.FacilityName = "local7" ' Local7 Facility
oSysSender.LevelName = "info" ' Info level
oSysSender.RemoteAddress = "127.0.0.1" ' Send to local host
oSysSender.RemotePort = "514" ' Use the standard UDP Syslog port
oSysSender.UseFile = False ' Send via UDP
oSysSender.UseRFC = False ' Don't use the RFC3164 format
oSysSender.UseUTF8 = True ' Encode the data as UTF8.
oSysSender.MessageText = "This is a test message send from KlogX.DLL"
' Now send the message
Dim RetVal
RetVal = oSysSender.SendMessage()
' Notify if message was sent successfully
If RetVal = True then
Response.write "Message sent successfully"
Else
Response.write "Message was not sent successfully. Error: " & oSysSender.Error_Data
End if
' Destroy the object
Set oSysSender = Nothing
%>
</BODY>
</HTML>
VB6 Example:
' Create the Syslog Sender object
Dim oSysSender As New KLog_COM.SyslogSender
' Set the properties
oSysSender.FacilityName = "local7" ' Local7 Facility
oSysSender.LevelName = "info" ' Info level
oSysSender.RemoteAddress = "127.0.0.1" ' Send to local host
oSysSender.RemotePort = "514" ' Use the standard UDP Syslog port
oSysSender.UseFile = False ' Send via UDP
oSysSender.UseRFC = False ' Don't use the RFC3164 format
oSysSender.UseUTF8 = True ' Encode the data as UTF8.
oSysSender.MessageText = "This is a test message send from KlogX.DLL"
' Now send the message
Dim RetVal
RetVal = oSysSender.SendMessage()
' Notify if message was sent successfully
If RetVal = True Then
MsgBox "Message sent successfully"
Else
MsgBox "Message was not sent successfully. Error: " & oSysSender.Error_Data
End If