Splunk Search

How to exclude equal values at the same field?

iabreu
New Member

Hello Splunkers,

I need a little help to exclude similar values at the same field in a search:

....| search ComputadorNome="PCSD-FA5-TI11" | eval CaminhoCompleto=Caminho+ArquivoInfectado | stats count by ComputadorNome, TextoResultado, UsuarioLogado, CaminhoCompleto, TipoScan

I need that all results that have similar values at field called "CaminhoCompleto" are not displayed at the result.

For example:

   Field 1------Caminhocompleto-------Field3---- 

1 123 ABC 098
2 324 ABC 987
3 234 CBA 678

In this case the line 1 and 2 would be excluded from the result, because the field Caminhocompleto have the value ABC appearing more than one time.

Best Regards,

Igor Abreu

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try something like this

If you want to filter those results after stats.

| search ComputadorNome="PCSD-FA5-TI11" | eval CaminhoCompleto=Caminho+ArquivoInfectado | stats count by ComputadorNome, TextoResultado, UsuarioLogado, CaminhoCompleto, TipoScan | evenstats count as tempcount by CaminhoCompleto | where tempcount=1

Before stats

 | search ComputadorNome="PCSD-FA5-TI11" | eval CaminhoCompleto=Caminho+ArquivoInfectado | evenstats count as tempcount by CaminhoCompleto | where tempcount=1 | stats count by ComputadorNome, TextoResultado, UsuarioLogado, CaminhoCompleto, TipoScan

View solution in original post

somesoni2
Revered Legend

The 2nd query should help.

0 Karma

iabreu
New Member

Yeah, exactly.

0 Karma

somesoni2
Revered Legend

Try something like this

If you want to filter those results after stats.

| search ComputadorNome="PCSD-FA5-TI11" | eval CaminhoCompleto=Caminho+ArquivoInfectado | stats count by ComputadorNome, TextoResultado, UsuarioLogado, CaminhoCompleto, TipoScan | evenstats count as tempcount by CaminhoCompleto | where tempcount=1

Before stats

 | search ComputadorNome="PCSD-FA5-TI11" | eval CaminhoCompleto=Caminho+ArquivoInfectado | evenstats count as tempcount by CaminhoCompleto | where tempcount=1 | stats count by ComputadorNome, TextoResultado, UsuarioLogado, CaminhoCompleto, TipoScan

somesoni2
Revered Legend

You want to exclude these entries (with more than 1 similar values) before the stats itself?

0 Karma

iabreu
New Member

No, I said "1" just to exemplify, I mean that if the field "CaminhoCompleto" have any equal values, all events will not be showed. For exemple:

Field 1------Caminhocompleto-------Field3----
123 ABC 098
324 ABC 987
234 CBA 678

In this case the line 1 and 2 would be excluded from the result, because the field Caminhocompleto have the value ABC appearing more than one time.

Regards.

0 Karma

strive
Influencer

Do you mean to say if the value for the field CaminhoCompleto is greater than 1 then you should exclude that event from the result

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...