Splunk Search

How do a search with a string comma separated values ?

JuanAntunes
Explorer

Hello team! How are u?

I have a question about how to search with a comma separated values:

 

Example:

I have an index with vm's information, like this:

JuanAntunes_2-1632151288903.png

 

In the column "datastores" returns me all datastores assigned to this VM, so I need to calculate how much freespace I have in this VM.

So I have another index, with the "datastores" information, like this:

JuanAntunes_3-1632151303605.png

 

I know how to filter just one result, but I don't know how I can filter two or more comma-separated datastores.

Can anyone help me? Thanks in advanced

Labels (3)
0 Karma
1 Solution

ashvinpandey
Contributor

@JuanAntunes Make sure your subsearch is also having the same datastores field name also the datastores field in the subsearch is also splitted if it contains "," and add below query line after your eval tmp:

| fields tmp



View solution in original post

ashvinpandey
Contributor

@JuanAntunes First split the values of your datastore field as a seperate row then search for it, like below:

| eval datastores=split(datastores,",") 
| mvexpand datastores
| search datastores="*"

Also, If this reply helps you, an upvote would be appreciated.

 

0 Karma

JuanAntunes
Explorer

Hi @ashvinpandey , first of all thanks for your time!

Here's the query I'm doing with your help, but still to no success.

JuanAntunes_0-1632152373077.png


Thanks again!

0 Karma

ashvinpandey
Contributor

@JuanAntunes Make sure your subsearch is also having the same datastores field name also the datastores field in the subsearch is also splitted if it contains "," and add below query line after your eval tmp:

| fields tmp



JuanAntunes
Explorer

Thanks so much!  @ashvinpandey  it works!

0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...