IP*Works! V9

ipworks
Class Syslog

java.lang.Object
  extended by ipworks.Syslog

public class Syslog
extends java.lang.Object

The Syslog bean is used to send and receive network system log packets.

The Syslog bean implements a lightweight BSD syslog client as specified in RFC 3164. The bean is used to send and receive BSD system network logging packets.

The first step in using the Syslog bean is to set LocalHost and LocalPort to the interface and port on which the host will be receiving syslog packets, then set Active to True. For each packet, the bean will parse the headers and message and fire a PacketIn event.


Constructor Summary
Syslog()
          Creates an instance of Syslog Bean.
Syslog(java.lang.String runtimeLicense)
          Creates an instance of Syslog Bean with specified run-time license.
 
Method Summary
 void addSyslogEventListener(SyslogEventListener l)
           
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a configuration setting.
 void doEvents()
          Processes events from the internal message queue.
 java.lang.String getLocalHost()
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 int getLocalPort()
          The port in the local host where Syslog binds.
 java.lang.String getRemoteHost()
          Sets a specific host for outgoing log packets.
 int getRemotePort()
          Sets a specific port for outgoing log packets.
 boolean isActive()
          Enables or disables sending and receiving of data.
 void removeSyslogEventListener(SyslogEventListener l)
           
 void sendPacket(int facility, int severity, java.lang.String message)
          Send a log packet to RemoteHost .
 void setActive(boolean active)
          Enables or disables sending and receiving of data.
 void setLocalHost(java.lang.String localHost)
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 void setLocalPort(int localPort)
          The port in the local host where Syslog binds.
 void setRemoteHost(java.lang.String remoteHost)
          Sets a specific host for outgoing log packets.
 void setRemotePort(int remotePort)
          Sets a specific port for outgoing log packets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Syslog

public Syslog()
Creates an instance of Syslog Bean.


Syslog

public Syslog(java.lang.String runtimeLicense)
Creates an instance of Syslog Bean with specified run-time license.

Method Detail

isActive

public boolean isActive()
Enables or disables sending and receiving of data.

Setting the Active property to True makes the bean create a communication endpoint (socket) which can be used for sending and receiving UDP datagrams. Setting it to False destroys the socket and disables data communications.


setActive

public void setActive(boolean active)
               throws IPWorksException
Enables or disables sending and receiving of data.

Setting the Active property to True makes the bean create a communication endpoint (socket) which can be used for sending and receiving UDP datagrams. Setting it to False destroys the socket and disables data communications.

Throws:
IPWorksException

getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multi-homed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multi-homed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.

Throws:
IPWorksException

getLocalPort

public int getLocalPort()
The port in the local host where Syslog binds.

The LocalPort property must be set before Syslog is activated ( Active is set to True). It instructs the bean to bind to a specific port (or communication endpoint) in the local machine.

Setting it to 0 (default) enables the TCP/IP stack to choose a port at random. The chosen port will be shown by the LocalPort property after the connection is established.

LocalPort cannot be changed once the bean is Active . Any attempt to set the LocalPort property when the bean is Active will generate an error.

The LocalPort property is useful when trying to connect to services that require a trusted port in the client side.


setLocalPort

public void setLocalPort(int localPort)
                  throws IPWorksException
The port in the local host where Syslog binds.

The LocalPort property must be set before Syslog is activated ( Active is set to True). It instructs the bean to bind to a specific port (or communication endpoint) in the local machine.

Setting it to 0 (default) enables the TCP/IP stack to choose a port at random. The chosen port will be shown by the LocalPort property after the connection is established.

LocalPort cannot be changed once the bean is Active . Any attempt to set the LocalPort property when the bean is Active will generate an error.

The LocalPort property is useful when trying to connect to services that require a trusted port in the client side.

Throws:
IPWorksException

getRemoteHost

public java.lang.String getRemoteHost()
Sets a specific host for outgoing log packets.

When a call is made to the SendPacket method, the bean will send it to whatever value is in RemoteHost . The default value is the broadcast address, "255.255.255.255".


setRemoteHost

public void setRemoteHost(java.lang.String remoteHost)
                   throws IPWorksException
Sets a specific host for outgoing log packets.

When a call is made to the SendPacket method, the bean will send it to whatever value is in RemoteHost . The default value is the broadcast address, "255.255.255.255".

Throws:
IPWorksException

getRemotePort

public int getRemotePort()
Sets a specific port for outgoing log packets.

When a call is made to the SendPacket method, the bean will send to RemoteHost on RemotePort . The default value is 514, the standard port as defined in the BSD syslog RFC 3164.


setRemotePort

public void setRemotePort(int remotePort)
                   throws IPWorksException
Sets a specific port for outgoing log packets.

When a call is made to the SendPacket method, the bean will send to RemoteHost on RemotePort . The default value is 514, the standard port as defined in the BSD syslog RFC 3164.

Throws:
IPWorksException

config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksException
Sets or retrieves a configuration setting.

Config is a generic method available in every bean. It is used to set and retrieve configuration settings for the bean.

Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.

The bean accepts one or more of the following configuration settings . Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

Syslog Configuration Settings

UseLocalTime
Indicates whether to use local time or GMT time for packet timestamps
Setting this to True will generate timestamps based on the time in your locality, taking into account your time zone. When this option is False (default), GMT timestamps are generated.
UseHostname
Determines if the local host name or IP address is used in the Syslog header
If set to false the bean will use the IP address of the local host name in the header of the Syslog packet. The default value is true.

UDPPort Configuration Settings

CaptureIPPacketInfo
Used to capture the packet information
If this is set to true, the component will capture the IP packet information.The default value for this setting is False.

Note: This setting is only available in Windows.

DestinationAddress
Used to get the destination address from the packet information
If CaptureIPPacketInfo is set to true, then this will be populated with the packet's destination address when a packet is received. This information will be accessible in the DataIn event.Note: This setting is only available in Windows.

LocalHost
The name of the local host through which connections are initiated or accepted
The LocalHost setting contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost setting shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multi-homed hosts (machines with more than one IP interface).

LocalPort
The TCP port in the local host where the bean binds
This must be set before a connection is attempted. It instructs the bean to bind to a specific port (or communication endpoint) in the local machine.Setting this to 0 (default) enables the system to choose a port at random. The chosen port will be shown by LocalPort after the connection is established.

LocalPort cannot be changed once a connection is made. Any attempt to set this when a connection is active will generate an error.

This; setting is useful when trying to connect to services that require a trusted port in the client side. An example is the remote shell (rsh) service in UNIX systems.

MaxPacketSize
The maximum length of the packets that can be received
This setting specifies the maximum size of the datagrams that the bean will accept without truncation.
ShareLocalPort
If set to True, allows more than one instance of the bean to be active on the same local port
This option must be set before the bean is activated through the Active property or it will have no effect.The default value for this setting is False.

UseConnection
Determines whether to use a connected socket
UseConnection specifies whether the bean should use a connected socket or not. The connection is defined as an association in between the local address/port and the remote address/port. As such, this is not a connection in the traditional TCP sense. What it means is only that the bean will send and receive data only to and from the specified destination.The default value for this setting is False.

QOSDSCPValue
Used to specify an arbitrary QOS/DSCP setting (optional)
UseConnection must be True to use this setting. This option allows you to specify an arbitrary DSCP value between 0 and 63. The default is 0. When set to the default value the component will not set a DSCP value.Note: This setting uses the qWAVE API is only available on Windows 7, Windows Server 2008 R2, and later.

QOSTrafficType
Used to specify QOS/DSCP settings (optional)
UseConnection must be True to use this setting. You may specify either the text or integer values: BestEffort (0), Background (1), ExcellentEffort (2), AudioVideo (3), Voice (4), and Control (5).Note: This setting uses the qWAVE API which is only available on Windows Vista and Windows Server 2008 or above.

Note: QOSTrafficType must be set before setting Active to true.

UseIPv6
Whether or not to use IPv6
By default, the component expects an IPv4 address for local and remote host properties, and will create an IPv4 socket. To use IPv6 instead, set this to True.

Socket Configuration Settings

AbsoluteTimeout
Determines whether timeouts are inactivity timeouts or absolute timeouts
If AbsoluteTimeout is set to True, any method which does not complete within Timeout seconds will be aborted. By default, AbsoluteTimeout is False, and the timeout is an inactivity timeout.
FirewallData
Used to send extra data to the firewall
When the firewall is a tunneling proxy, use this property to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).
InBufferSize
The size in bytes of the incoming queue of the socket
This is the size of an internal queue in the TCP/IP stack. You can increase or decrease its size depending on the amount of data that you will be receiving. Increasing the value of the InBufferSize setting can provide significant improvements in performance in some cases.Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the bean is activated the InBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.

OutBufferSize
The size in bytes of the outgoing queue of the socket
This is the size of an internal queue in the TCP/IP stack. You can increase or decrease its size depending on the amount of data that you will be sending. Increasing the value of the OutBufferSize setting can provide significant improvements in performance in some cases.Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the bean is activated the OutBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.

Base Configuration Settings

GUIAvailable
Tells the bean whether or not a message loop is available for processing events
In a GUI-based application, long-running blocking operations may cause the application to stop responding to input until the operation returns. The bean will attempt to discover whether or not the application has a message loop and, if one is discovered, it will process events in that message loop during any such blocking operation.In some non-GUI applications an invalid message loop may be discovered that will result in errant behavior. In these cases, setting GuiAvailable to false will ensure that the bean does not attempt to process external events.

Throws:
IPWorksException

doEvents

public void doEvents()
              throws IPWorksException
Processes events from the internal message queue.

When DoEvents is called, the bean processes any available events. If no events are available, it waits for a preset period of time, and then returns.

Throws:
IPWorksException

sendPacket

public void sendPacket(int facility,
                       int severity,
                       java.lang.String message)
                throws IPWorksException
Send a log packet to RemoteHost .

System log packets are composed of three main sections, each of which can be broken down into two smaller pieces.

The first section is the PRI, which contains the originating Facility and Severity of the Message . Facility is a value from 0 to 23, with each value being a different part of the system:

0
Kernel messages
1
User-level messages
2
Mail system
3
System daemons
4
Security/authorization messages
5
Messages generated internally by syslogd
6
Line printer subsystem
7
Network news subsystem
8
UUCP subsystem
9
Clock daemon
10
Security/authorization messages
11
FTP daemon
12
NTP subsystem
13
Log audit
14
Log alert
15
Clock daemon
16
Local use
17
Local use
18
Local use
19
Local use
20
Local use
21
Local use
22
Local use
23
Local use

Severity is a value from 0 to 7 using the following convention:

0
Emergency - the system is unusable
1
Alert - action must be taken immediately
2
Critical - critical conditions exist
3
Error - error conditions exist
4
Warning - warning conditions exist
5
Notice - normal but significant condition
6
Informational - informative message
7
Debug - debug-level messages

The section sections contains a timestamp and hostname, both of which are automatically generated by the bean. The third section is the Message itself.

Throws:
IPWorksException

addSyslogEventListener

public void addSyslogEventListener(SyslogEventListener l)
                            throws java.util.TooManyListenersException
Throws:
java.util.TooManyListenersException

removeSyslogEventListener

public void removeSyslogEventListener(SyslogEventListener l)

IP*Works! V9

Copyright (c) 2013 /n software inc. - All rights reserved.