Splunk Search

How to exclude some result from rex max_match

dpatiladobe
Explorer

I am trying to search all Measures and Dimensions captured from Extended events of sql server analytics service.

index=xxx sourcetype=extendedevent NTUserName=xxx DatabaseName=xxx AND NOT (NTUserName IN (xxxxx) ) SELECT | rex "TextData=(?P.*);NTCanonicalUserName" | rex field=TextData1 max_match=10000 "\[Measures\].\[(?[a-z0-9A-Z _]+)]" |rex field=TextData1 max_match=10000 "\"(?[a-z0-9A-Z _]+)\"" |eval Measures1= "[Measures]"
|rex field=TextData1 max_match=10000 "[{(](?[a-z0-9A-Z -_\].[]+)" | table Measures1, Measures, Dimensions ,TextData1, Dim ,_raw, DatabaseName

when i try | where Dimensions NOT match(Dimensions,Measures1 ) it excludes all result for that match not just one result.

index=xxx sourcetype=extendedevent  NTUserName=xxx DatabaseName=xxx  AND NOT (NTUserName IN (xxxxx) )  SELECT   | rex "TextData=(?P<TextData1>.*);NTCanonicalUserName"    | rex field=TextData1 max_match=10000 "\[Measures\].\[(?<Measures>[a-z0-9A-Z _]+)]" |rex field=TextData1 max_match=10000 "\"(?<Measures>[a-z0-9A-Z _]+)\""  |eval Measures1= "[Measures]"
 |rex field=TextData1 max_match=10000 "[{(](?<Dimensions>[a-z0-9A-Z -_\].[]+)"  | where Dimensions NOT match(Dimensions,Measures1 ) |  table Measures1, Measures, Dimensions ,TextData1, Dim ,_raw, DatabaseName

Example

SELECT {[Measures].[Responses],[Measures].[Scored Responses]} DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON COLUMNS , NON EMPTY Hierarchize({DrilldownLevel({[Sales User - Creator].[Manager Full Name].[All]},,,INCLUDE_CALC_MEMBERS)}) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS FROM [MIA] WHERE ([Date - Created].[Fiscal Yr Qtr Period Day].[Fiscal Year].&[2019].&[2019-Q4].&[2019-10]) CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS

It captures the perfectly the measures
Responses
Scored Responses

But not sure how can better do with capturing the Dimensions , my idea is to capture everything in brackets and then excludes the measures.

0 Karma

to4kawa
Ultra Champion
| makeresults
| eval _raw="SELECT {[Measures].[Responses],[Measures].[Scored Responses]} DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON COLUMNS , NON EMPTY Hierarchize({DrilldownLevel({[Sales User - Creator].[Manager Full Name].[All]},,,INCLUDE_CALC_MEMBERS)}) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS FROM [MIA] WHERE ([Date - Created].[Fiscal Yr Qtr Period Day].[Fiscal Year].&[2019].&[2019-Q4].&[2019-10]) CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS"
| rex mode=sed "s/{.*}//"
| rex max_match=0 "\[(?<inblacket>.*?)\]"
0 Karma

dpatiladobe
Explorer

Thanks It gave me different direction to think.

0 Karma

to4kawa
Ultra Champion

If you resolve your question, please accept it.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...