Splunk Search

Using mvappend within a cidrmatch macro

CarbonCriterium
Path Finder

I already have the following macro  `subnet(3)`  defined as the following:

 

 

| eval subnet = case(cidrmatch("$ip1$/24",src_ip), "$output_name$", cidrmatch("$ip2$",src_ip), "$output_name$")

 

 

 

If I call the macro multiple in the same search the value of the field it creates (also called subnet) will be overwritten by the latest values.   I would like to edit the macro so that calling it multiple times appends a new value to subnet.  How could I use mvappend, or another command, to accomplish this?

Labels (1)
0 Karma
1 Solution

CarbonCriterium
Path Finder

Never mind.  Figuring it out just required taking a step back and reading the docs again.

 

| eval subnet = mvappend(case(cidrmatch("$ip1$/24",src_ip), "$output_name$", cidrmatch("$ip2$",src_ip), "$output_name$"),subnet)

 

 

View solution in original post

0 Karma

CarbonCriterium
Path Finder

Never mind.  Figuring it out just required taking a step back and reading the docs again.

 

| eval subnet = mvappend(case(cidrmatch("$ip1$/24",src_ip), "$output_name$", cidrmatch("$ip2$",src_ip), "$output_name$"),subnet)

 

 

0 Karma
Get Updates on the Splunk Community!

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...

SignalFlow: What? Why? How?

What is SignalFlow? Splunk Observability Cloud’s analytics engine, SignalFlow, opens up a world of in-depth ...

Federated Search for Amazon S3 | Key Use Cases to Streamline Compliance Workflows

Modern business operations are supported by data compliance. As regulations evolve, organizations must ...