Logscape Support

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Character sets as delimiters


Veteran Member

Status: Offline
Posts: 56
Date:
Character sets as delimiters
Permalink  
 


I want to grab a portion of a line with something like this somewhere in the string:     121ms 11232 455433 BATCH(11) SELECT table_name from sys_tables

In the line there can be nearly any number of space separated strings between the 'ms' and "SELECT"

and "SELECT" can be any SQL keyword and can be in upper or lower case

I want to do something like this:    \d+ms\s(**)\sSELECT|select|INSERT|insert|DELETE|delete

to grab the values between "ms" and the the SQL statement.  I also need a pattern to grab from the beginning of the SQL statement to the end of the line.  I've tried a few things without success.  Is this possible, if so, how?

 



__________________


Veteran Member

Status: Offline
Posts: 56
Date:
Permalink  
 

After some more experimenting I found something that worked and I could grab a value from a line starting (and including) one of a set of words

((SELECT|select|INSERT|insert|DELETE|delete|UPDATE|update|MERGE|merge|CALL|call)(.*))

This will grab the characters starting with one of a set of words (SQL commands in this case) and match from there to the end of the line.  Note the trick was to put two groups inside of a group ((word1|word2|word3)(.*))



__________________


Veteran Member

Status: Offline
Posts: 56
Date:
Permalink  
 

Is there a way in a search to do an 'ignore case' so "SELECT" and "select" would be counted as the same thing?

__________________


Member

Status: Offline
Posts: 23
Date:
Permalink  
 

Hi Skazal,

I know everything has already been sorted by email but thought it best to include it on here as well, in case anyone else has the same question.

In your datatypes page you'll want to make a new field which will be used for your lower case values.

In your case, I believe the field you want to convert is called 'sqlop' so we'll want to use a groovy script to lower the case of the sqlop field. To use a groovy script, start your synth expression with "groovy-script:" in your case we want to take the sqlop field and make sure its the same case, so we'd use the following groovy script.

groovy-script:
return sqlop.toLowerCase()

You can then use this field for your search.


__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.



Create your own FREE Forum
Report Abuse
Powered by ActiveBoard