Splunk Search

REMOVE AN EXTRA FIELD

sphiwee
Contributor

i have regular expression that i use to extract the below words, but i dont want to show the Results fiels or column, how do i exclude it? 

 

Ive tried        | fields -Results  & it didnt work  

 

Isphiwee_0-1603112079235.png

 

Labels (4)
Tags (1)
1 Solution

thambisetty
SplunkTrust
SplunkTrust

can you try below command after rex command and check if you see field business_field and value Results. if you don't see that means there could be white space added at starting or ending of Results value. 

| search business_field=* NOT business_field=Results
| stats count by business_field
| search business_field=*Results*

 you can try below to make sure there is white space.

| search business_field=* NOT business_field=Results
| stats count by business_field
| search business_field=*Results*

if above search works then you can try below in your actual search

| search business_field=* NOT business_field=*Results*

 

————————————
If this helps, give a like below.

View solution in original post

thambisetty
SplunkTrust
SplunkTrust

can you try below command after rex command and check if you see field business_field and value Results. if you don't see that means there could be white space added at starting or ending of Results value. 

| search business_field=* NOT business_field=Results
| stats count by business_field
| search business_field=*Results*

 you can try below to make sure there is white space.

| search business_field=* NOT business_field=Results
| stats count by business_field
| search business_field=*Results*

if above search works then you can try below in your actual search

| search business_field=* NOT business_field=*Results*

 

————————————
If this helps, give a like below.

thambisetty
SplunkTrust
SplunkTrust

replace your search command just before timechart with below

 

| search business_field=* NOT business_field=Results

if you think you have got 100% matches for field business_field extracted using rex command the below search would be enough. no need to say business_field=* ( this is useful to ignore null values in events  if there are any events they are not matched  for regex and returned null values)

 

| search NOT business_field=Results​

 

————————————
If this helps, give a like below.

sphiwee
Contributor

still not working 

sphiwee_0-1603116274868.png

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sphiwee,

could you try to execute the last search in verbose mode?

Ciao.

Giuseppe

0 Karma

thambisetty
SplunkTrust
SplunkTrust

share your query to understand if Results appeared in chart  has derived from another field.

————————————
If this helps, give a like below.

sphiwee
Contributor

sphiwee_0-1603113586356.png

Heres the query, i want to remove the far right field "Results"

0 Karma

sphiwee
Contributor

here is my query @inventsekar 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sphiwee,

put a space between - and the field name

| fields - Results

Ciao.

Giuseppe

sphiwee
Contributor

Still not working

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sphiwee,

sorry, I misunderstood!

Try adding to the last "search command" also

NOT business_field="Results"

 

P.S.: you don't need "AND" operator in search.

Ciao.

Giuseppe

 

sphiwee
Contributor

 

sphiwee_0-1603114675448.png

Still not working, now receiving an error

inventsekar
SplunkTrust
SplunkTrust

Hi @sphiwee whats your current search query? you can not use "business_field=Results" inside the fields command.

 

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !

gcusello
SplunkTrust
SplunkTrust

Hi @sphiwee,

sorry I wasn't clear, in your search replace 

| search business_field=* AND "status:COMPLETED"

 with

| search business_field=* "status:COMPLETED" NOT business_field="Results"

and do not use more the field command.

Ciao.

Giuseppe

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...