Splunk Search

Filter transaction

indeed_2000
Motivator

Hi

i have log line like this,

1-need to group by them by ID,

2- filter those transactions that has T[A]

 

#txn1
16:30:53:002 moduleA ID[123]
16:30:54:002 moduleA ID[123]
16:30:55:002 moduleB ID[123]T[A]
16:30:56:002 moduleC ID[123]

#txn2
16:30:57:002 moduleD ID[987]
16:30:58:002 moduleE ID[987]T[B]
16:30:59:002 moduleF ID[987]
16:30:60:002 moduleZ ID[987]

 

Any idea?

Thanks

Labels (4)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What fields do you already have extracted?

By "filter" do you mean filter in or filter out i.e. do you want to keep the events with T[A], keep only those events with T[A] or remove them altogether?

0 Karma

indeed_2000
Motivator

@ITWhisperer need to see filter out/in result to decide.

All fields extracted already.

need keep the events with T[A].

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| sort 0 ID
0 Karma

indeed_2000
Motivator
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your events will be together by ID

0 Karma

indeed_2000
Motivator

@ITWhisperer 

How about other part? 

FYI: i mean extract key value one by one with rex command not whole transaction.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Not sure I understand, you just said all fields already extracted?

0 Karma

indeed_2000
Motivator

@ITWhisperer i mean id, t , … key value extracted not transaction.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What do you mean by transaction?

0 Karma

indeed_2000
Motivator

@ITWhisperer 

#txn1
16:30:53:002 moduleA ID[123]
16:30:54:002 moduleA ID[123]
16:30:55:002 moduleB ID[123]T[A]
16:30:56:002 moduleC ID[123]

#txn2
16:30:57:002 moduleD ID[987]
16:30:58:002 moduleE ID[987]T[B]
16:30:59:002 moduleF ID[987]
16:30:60:002 moduleZ ID[987]

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

How do you determine which events are part of a "transaction"?

0 Karma

indeed_2000
Motivator

@ITWhisperer group by id

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| stats list(_raw) as _raw by ID
0 Karma

indeed_2000
Motivator

@ITWhisperer you miss main question and I tell you step by step main question!

Would you please check main question? And tell me is there any way to do that?

thanks

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| stats list(_raw) as _raw list(T) as T by ID
| where T=="A"
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...