Splunk Search

What is the difference between the Eval and the FIELDALIAS commands?

shayhibah
Path Finder

I am wondering what is the difference between eval & fieldalias commands?

For example:
EVAL-app = if(isnull(service),app,service)
FIELDALIAS-log = service AS app

In the first case, if service is null, app stay as is.
In the second case, if service is null, app is null.

Can someone explain it please?
Thanks

Tags (1)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@shayhibah

Search-time operation sequence will help you to understand this. 🙂

http://docs.splunk.com/Documentation/Splunk/7.2.0/Knowledge/Searchtimeoperationssequence

Thanks

shayhibah
Path Finder

I read this page and it gave me some more information but I still cannot understand why the output of FILEDALIAS is null in some cases.

0 Karma

lwest_splunk
Splunk Employee
Splunk Employee

@shayhibah please see the answer I placed on your other answers ask found here:

https://answers.splunk.com/answers/657473/fieldalias-override-another-fieldalias.html?childToView=76...

Hope this helps give some clarity to you for the FIELDALIAS function and its limitations!

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@shayhibah

1)

EVAL-app = if(isnull(service),app,service)

In this case, we are deciding app field on the basis of the service. If service is not available then app will be the same value available in the event. which can be null (if app not found in the event) or not null (if app found in the event). So if service field is available then service will be assigned to the app field. if service field is not available then app will be assigned to app (if the event has app field ). if app field is not available then app will be null.

2

FIELDALIAS-log = service AS app

In this case, we are deciding app field on the basis of the service field regardless of field available or not. So if service field is available then service will be assigned to the app. if service field is not available then app will be null.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...