TEXTLINE

The textline datasources a file datasource that reads line based text files, and returns a row for each line in the file

Columns

Column NameData TypeDescription
FileNameSTRINGThe absolute name of the file the line occures in
RowNumberLONGThe line number (start line)
TextSTRINGThe text of the line in the file

Properties

When using a text line datasource, the followign properties are available

PropertyRequiredDescription
filePatternYesA File pattern to use when loading files to process. Suupports wildcard characters. The datasource will then process ALL files matching this pattern. This is the default parameter and will be populated if the query is in the format SELECT * FROM 'file' USING TEXTLINE
linePatternNoA Regular expression pattern, used to match a row of data. This is usefull for log files where exception stack traces occur, but you wish to process the stack trace on the same line as the error log

Examples

Given the followintg log:

	
01/01/2003 01:01:30 INFO Starting application
01/01/2003 01:01:31 ERROR java.nio.channels.AsynchronousCloseException
java.nio.channels.AsynchronousCloseException
	at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:205)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:412)
	at com.xar.IoSession.read(IoSession.java:250)
	at com.xar.SyncIoProcessor.run(SyncIoProcessor.java:42)
	at java.lang.Thread.run(Thread.java:745)
01/01/2003 01:01:30 INFO IO Failure, aborting
	

Using the following Query will produce three lines as output with the second line a multi line row containing the complete stack trace

	
SELECT * FROM 'logfile.log' USING TEXTLINE(linePattern='\d{2}/\d{2}/\d{4}.+')
	
	
FileName      RowNumber Text                                                                                                     
------------- --------- -------------------------------------------------------------------------------------------------------- 
multiline.log 1         01/01/2003 01:01:30 INFO Staring application                                                                     
multiline.log 2         01/01/2003 01:01:30 INFO Starting application                                                            
multiline.log 3         01/01/2003 01:01:31 ERROR java.nio.channels.AsynchronousCloseException                                   
                        java.nio.channels.AsynchronousCloseException                                                             
                            at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:205) 
                            at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:412)                                 
                            at com.xar.IoSession.read(IoSession.java:250)                                                    
                            at com.xar.SyncIoProcessor.run(SyncIoProcessor.java:42)                                          
                            at java.lang.Thread.run(Thread.java:745)                                                         
multiline.log 10        01/01/2003 01:01:30 INFO IO Failure, aborting        
	
clear