Splunk Search

help on a field rename in a subsearch

jip31
Motivator

hi

I use the subsearch below in order to match host in host.csv with host in the index
But in the index, the host field is called USERNAME
So I am doing a rename in my subsearch but I am unable to match with the index events
what is the problem please??

[| inputlookup host.csv 
    | table host| rename host as USERNAME ] index=A sourcetype=wireless USERNAME=TOTA
Tags (1)
0 Karma
1 Solution

DavidHourani
Super Champion

Hi @jip31,

Maybe USERNAME=TOTA is causing the problem as it only filters on TOTA. Try it as follows :

index=A sourcetype=wireless   [| inputlookup host.csv | table host| rename host as USERNAME ] 

If you want to enrich your data with the lookup then this should do :

index=A sourcetype=wireless  | lookup host.csv host AS USERNAME

Best regards,
David

View solution in original post

0 Karma

DavidHourani
Super Champion

Hi @jip31,

Maybe USERNAME=TOTA is causing the problem as it only filters on TOTA. Try it as follows :

index=A sourcetype=wireless   [| inputlookup host.csv | table host| rename host as USERNAME ] 

If you want to enrich your data with the lookup then this should do :

index=A sourcetype=wireless  | lookup host.csv host AS USERNAME

Best regards,
David

0 Karma

jip31
Motivator

thanks to you

0 Karma

chrispounds
Explorer

I think you need to place the search before the lookup, so it would look something like this

index-A sourcetype=wireless USERNAME=TOTA [inputlookup host.csv | table host | rename host as USERNAME]

See if that works perhaps?

0 Karma

jip31
Motivator

its not working...

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...