Dashboards & Visualizations

How to join where a macro is used in the search?

POR160893
Builder

Hi,

On Splunk, I have a macro called `ABC` . I use this macro in the first search like this:
`ABC`
| stats values(src_ip) values(src_zone) values(dest_ip) values(dest_port) values(app) values(transport) values(session_end_reason) by host rule action
| rename values(*) as *
| rex field=host "(?<host_new>[^\.]+?)(?:\.[01]|\.02)?\."
I also have a second Splunk search as follows:
| rex field=Device_FQDN "(?<Device_FQDN>[^\.]+?)(?:\.[01]|\.02)?\."
I need to JOIN BOTH searches using the field "host_new" from the first search and the field "Device_FQDN" from the second search as the common fields to perform the JOIN on.
What would the Splunk query be in this case, using both searches I have supplied and where the first search uses a macro?


Many thanks,
P

Labels (4)
0 Karma

TrangCIC81
Communicator

can you try something like this?

 

 

(index=<your_index> <your_first_search> | `ABC`
| stats values(src_ip) values(src_zone) values(dest_ip) values(dest_port) values(app) values(transport) values(session_end_reason) by host rule action
| rename values(*) as *
| rex field=host "(?<host_new>[^\.]+?)(?:\.[01]|\.02)?\.") 
| join host_new [| <your_second_search> | rex field=Device_FQDN "(?<Device_FQDN>[^\.]+?)(?:\.[01]|\.02)?\." | fields Device_FQDN host_new]

 

 Using the join command to join the first search with the second search.  

0 Karma

POR160893
Builder

I have already provided you with the first and second searches, though. The first search is:
`palo_logs(traffic)`
| stats values(src_ip) values(src_zone) values(dest_ip) values(dest_port) values(app) values(transport) values(session_end_reason) by host rule action
| rename values(*) as *
| rex field=host "(?<host_new>[^\.]+?)(?:\.[01]|\.02)?\."

and the second search is:
| rex field=Device_FQDN "(?<Device_FQDN>[^\.]+?)(?:\.[01]|\.02)?\."


So, what would the join look like?

0 Karma
Get Updates on the Splunk Community!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...