Splunk Search

Purpose of the "AS" statement in SPLUNK

mahbs
Path Finder

Hi,

What is the purpose of the AS statement in splunk?

I thought, when used, it creates an alias of a column/field as it does in SQL, however, I've found that when used in a lookup statement, it acts as a sort of comparison, for instance in the following query:

index=web_proxy | lookup full_user_names.csv username AS local_user OUTPUTNEW first_name, last_name

i thought username field would be renamed as"Local_user" because of the AS statement, however, I've been told that the statement in this scenario checks to see if a value in local_user matches a value in username.

Can someone explain to me what the function of this statement is?

Thanks

Tags (1)
0 Karma
1 Solution

HiroshiSatoh
Champion

It just specifies a field that matches the lookup table.

<lookup-field> [AS <event-field>]

EX.
index=web_proxy|rename local_user as username
| lookup full_user_names.csv username OUTPUTNEW first_name, last_name

EX.
index=web_proxy
| lookup full_user_names.csv username as local_user OUTPUTNEW first_name, last_name,username
|table local_user ,username,first_name, last_name

View solution in original post

HiroshiSatoh
Champion

It just specifies a field that matches the lookup table.

<lookup-field> [AS <event-field>]

EX.
index=web_proxy|rename local_user as username
| lookup full_user_names.csv username OUTPUTNEW first_name, last_name

EX.
index=web_proxy
| lookup full_user_names.csv username as local_user OUTPUTNEW first_name, last_name,username
|table local_user ,username,first_name, last_name

Get Updates on the Splunk Community!

Your Guide to Splunk Digital Experience Monitoring

A flawless digital experience isn't just an advantage, it's key to customer loyalty and business success. But ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

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 ...