Sending (syslog) messages without priority tag

Version 2

    Example 1: w3Sockets component

    w3Sockets (from dimac.net) is a good freeware socket component that means you can send custom tcp packets from Kiwi Syslog Server.  w3Sockets can be found here: http://www.dimac.net.  A sample RunScript action that you could set up to send the custom tcp packet (using w3sockets) provided below:

    NB. This sample will send a tcp packet (in syslog format, ie. with priority tag <nnn>; but this can be changed in the socket.sendtext line of the script).  The packet will be sent to localhost, port 1468 (tcp).

    The script caches the TCP connection in the Kiwi Syslog Server global cache - this is done for performance reasons.

    To set up: Create a script file with text below, add a RunScript action, with full read/write attributes set, language=vbscript.

    Function Main()

        Dim socket
       
        If TypeName(Fields.VarGlobal01)<>"TCP" Then
            'Create new TCP connection to 127.0.0.1 port 1468
            Set socket = CreateObject("socket.tcp")
            socket.host = "127.0.0.1:1468"
            socket.open
            'Cache TCP connection
            Set Fields.VarGlobal01 = socket
        End If
       
        'Bind to TCP connection object in cache
        Set socket = Fields.VarGlobal01
       
        'Send custom TCP packet
        socket.sendtext "<191>Hello"

        'or, Send syslog message content (not really syslog: no PRI tag)
        'socket.sendtext Fields.VarCleanMessageText

        ' Set the return value to indicate that the script ran correctly
        Main = "OK"

    End Function

    w3Socket reference: http://www.dimac.net/Products/FreeProducts/w3Sockets/Reference/Refstart.htm

    Example 2: MSWinsock component

    The script would send a Custom UDP packet to destination; here is a working VBScript example (requires MSWinsock component, which you'll have if Kiwi Syslog is installed).

    'SendUDP.vbs
    Set oSocket = CreateObject("MSWinsock.Winsock")
    oSocket.Protocol = 1 'UDP protocol
    oSocket.RemoteHost = "192.168.1.1" 'Destination device
    oSocket.RemotePort = 1505 'Destination port
    oSocket.SendData "Hello there!"
    Set oSocket = Nothing

    If you want to use a RunScript action, you can change "Hello there!" to Fields.VarCleanMessageText (the current syslog message text)

    'SendUDP.vbs
    Set oSocket = CreateObject("MSWinsock.Winsock")
    oSocket.Protocol = 1 'UDP protocol
    oSocket.RemoteHost = "192.168.1.1" 'Destination device
    oSocket.RemotePort = 1505 'Destination port
    oSocket.SendData Fields.VarCleanMessageText
    Set oSocket = Nothing