Database Command Source

Definition

Protocol

Action

 

 

Description

Execute SQL Command every TimeInterval and place its result into FieldName and its error output into FieldName. Log into DatabaseLogin.  

 

 

Comments

Event Field Contents
ev:host Hostname
ev:app SQL Database
ev:log

<Database URI>

If Command or the first FieldName is missing, blank or invalid, disable this source. If the second FieldName is missing, blank or invalid, error output will not be accessible.

In the result FieldName, the "pipe" symbol '|' is used to separate fields in a database record, and multiple records are separated by newline characters.

If the TimeInterval is zero, empty, or missing, the source will be disabled.

The TimeInterval starts when the command is initiated, but another command will not be sent until the prior command has completed.

A new event is created each time this command is successfully executed.

Special XML characters are translated according to the XML character translation table.

 

Example

<source objectId="DbCmdSource" type="DatabaseCommandSource" stdout="FS.DemoAlive">
	<parameter type="Command">select * from Events where Events.host = ‘LarsHost'</parameter>
	<parameter type="FieldName">ev:msg2</parameter>
	<parameter type="TimeInterval">
		<time>12</time>
		<units>hr</units>
	</parameter>
	<parameter type=”DatabaseLogin”>
		<url>jdbc:mysql://localhost/events</url>
		<driver>org.gjt.mm.mysql.Driver</driver>
		<user>username</user>
		<password>pass</password>
	</parameter>
</source> 

Event Mapping

Resulting XML:

<event xmlns:ev="http://www.eventgnosis.com/">
	<ev:host>filipov</ev:host>
	<ev:app>SQL Command</ev:app>
	<ev:app>select * from events where events.msg = '12.34.56.78'</ev:log>
	<ev:protocol>Text Log</ev:protocol>
	<ev:msg2>This new line came from the database.</ev:msg2>
</event>