genjdbc
Milestone: 1
Synopsis
Connects to datasources using JDBC driver, executes a select query and for each record returned, emits an event.
Note: You may want to consider using the newer jdbc plugin
input {
genjdbc {
jdbcHost => ... # string (required)
jdbcPort => ... # string (required)
jdbcDBName => ... # string (required)
jdbcTargetDB => ... # string (required)
jdbcDriverPath => ... # string (required)
jdbcUser => ... # string (required)
jdbcPassword => ... # string (required)
jdbcSQLQuery => ... # string (required)
jdbcURL => ... # string (optional)
jdbcTimeField => ... # string (optional)
jdbcPollInterval => ... # number (optional), default: 60
jdbcCollectionStartTime => ... # string (optional)
jdbcPStoreFile => ... # string (optional)
}
}
Details
This plugin takes basic JDBC configuration information, an SQL query and some timing control. It then runs that queryr (with some additional timing information applied) in a loop, emitting events corresponding to each row in the returned table. For example
genjdbc {
jdbcHost => 'X.X.X.X'
jdbcPort => '50000'
jdbcTargetDB => 'db2'
jdbcDBName =>'MYDB'
jdbcUser => 'myuser'
jdbcPassword => 'mypasswd'
jdbcDriverPath => '/path/to/my/driver/db2jcc4.jar'
jdbcSQLQuery => 'select * from DT_ALARM_HIST where SUPPRESSED_DESC is null'
jdbcTimeField => 'TSTAMP'
jdbcPStoreFile => './test.pstore'
jdbcCollectionStartTime => '2015-01-01 00:00:00.000'
}
In the above example. the query will have where 'TSTAMP' >= currentTime'
appended to it. currentTime
is an internal variable maintained by the plugin which will be incremented on each loop with the timestamp of the last record returned from the query.
- Value type is String
- There is no default for this setting
jdbc host name. Used to form jdbc url
- Value type is String
- There is no default for this setting
jdbc port number. Used to form jdbc url
- Value type is String
- The default value is ""
Name of database on server / schema name. Used to form jdbc url
- Value type is String
- There is no default value for this item
Target DB name(vendor). used to select appropriate JDBC format. Supported types
- Value type is String
- There is no default value for this item
path to jdbc driver
- Value type is String
- There is no default value for this item
jdbc user name. Used to form jdbc url
- Value type is String
- There is no default value for this item
jdbc password. Used to form jdbc url
- Value type is String
- There is no default value for this item
SQL query to execute or the path of a text file which contains the query to execute.
jdbcSQLQuery => "select * from myTable"
In the latter case, prefix the filename with 'file:' e.g.
jdbcSQLQuery => "file:/path/to/my/query.txt"
- Value type is String
- There is no default value for this item
jdbc URL - explicitly set the jdbc URL string. Overrides all other URL component settings (e.g jdbcHost, jdbcPort)
- Value type is String
- There is no default value for this item
Name of the table column which contains timestamp information. This string will be used in the automatically generated SQL query as part of the where
clause.
- Value type is Number
- 60
The number of seconds to wait between query loops. A query loop executes the query, waits for a response, processes the response ( by emitting events). Once these steps are completed, the plugin will wait the specified amount of time before starting again and invoking the query.
- Value type is String
- There is no default value for this item
This is a timestamp expressed as a string e.g. '2015-01-01 00:00:00.000'
. It will be used in direct comparison operations against the specified jdbcTimeField
so the precise format depends on the database and the nature of the time column referenced.
- Value type is String
- There is no default value for this item
The pathname of a file which is used to maintain state for this operator. It is useful to be able to specify this as you may have multiple genjdbc
plugins.
Hello! I'm your friendly footer. If you're actually reading this, I'm impressed.