Splunk Search

How to edit my search to get all fields associated with an internal_message_id field?

packet_hunter
Contributor

Trying to correlate email security appliance logs to email malware analysis logs.

I am using the following code that returns a field internal_message_id with different values via the--> | stats list(*).

index=AAA sourcetype="Xmail" eventtype=X_email [search index=BBB sourcetype=Y_cef_syslog eventtype=Y suser=*  | fields suser| rex field=suser "(?<attacker>[\w\d\.\-\@]+)" | eval sender= lower(attacker) |table sender] | search internal_message_id=*  |stats list(*)

Within index=AAA, there are a number of events that share the unique value for the internal_message_id field.

Need a little help pulling all the other field values from events (in index=AAA) that share the same unique internal_message_id value.

For example, with each unique internal_message_id, I can stitch together separate events that contain fields such as "sender" , "recipient", "message_subject", "file_name", etc.

Currently the code is returning the correct fields but more than just the specific events related to the subsearch sender results.

Any help greatly appreciated.

0 Karma
1 Solution

somesoni2
Revered Legend

How about this

index=AAA sourcetype="Xmail" eventtype=X_email [search index=BBB sourcetype=Y_cef_syslog eventtype=Y suser=*  | fields suser| rex field=suser "(?<attacker>[\w\d\.\-\@]+)" | eval sender= lower(attacker) |table sender] | search internal_message_id=*  |stats list(*) by internal_message_id

Update

Try this

index=AAA [ search index=AAA sourcetype="Xmail" eventtype=X_email [search index=BBB sourcetype=Y_cef_syslog eventtype=Y suser=*  | fields suser| rex field=suser "(?<attacker>[\w\d\.\-\@]+)" | eval sender= lower(attacker) |table sender] | stats count by internal_message_id  | table internal_message_id] | table *

View solution in original post

somesoni2
Revered Legend

How about this

index=AAA sourcetype="Xmail" eventtype=X_email [search index=BBB sourcetype=Y_cef_syslog eventtype=Y suser=*  | fields suser| rex field=suser "(?<attacker>[\w\d\.\-\@]+)" | eval sender= lower(attacker) |table sender] | search internal_message_id=*  |stats list(*) by internal_message_id

Update

Try this

index=AAA [ search index=AAA sourcetype="Xmail" eventtype=X_email [search index=BBB sourcetype=Y_cef_syslog eventtype=Y suser=*  | fields suser| rex field=suser "(?<attacker>[\w\d\.\-\@]+)" | eval sender= lower(attacker) |table sender] | stats count by internal_message_id  | table internal_message_id] | table *

packet_hunter
Contributor

I must have accidentally cleaned out your additional post:

Can you just run this and see if it returns just the list of internal_message_id field which corresponds to attacker/sender from index=BBB?

index=AAA sourcetype="Xmail" eventtype=X_email [search index=BBB sourcetype=Y_cef_syslog eventtype=Y suser=*  | fields suser| rex field=suser "(?[\w\d\.\-\@]+)" | eval sender= lower(attacker) |table sender] | stats count by internal_message_id  | table internal_message_id

If above works fine without any problems, copy the above query into following format

 index=AAA [ search   <>   ]  | table *

Yes sir!!! that also works!!! Thank you!

0 Karma

packet_hunter
Contributor

Thank you Somesoni2!
I had to clean up the post so not to confuse anyone with my inability to post your query correctly.... d'oh!*&!
This is definitely what I was after, and I thank you for showing how to nest these subsearches correctly.

0 Karma
Get Updates on the Splunk Community!

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...

Cloud Platform & Enterprise: Classic Dashboard Export Feature Deprecation

As of Splunk Cloud Platform 9.3.2408 and Splunk Enterprise 9.4, classic dashboard export features are now ...