Splunk Search

eval isnull

Contributor

Hi!

Anyone know why i'm still getting NULL in my timechart?

The lookup "existing" has two columns "ticket|hostmessage". hostmessage column matches the eval expression host+CISCO_MESSAGE below... I **can get the host+message+ticket number to show up in the timechart with the following query - however if the results do not match hostmessage in the lookup, hostTICKET comes back null.** I want null to simply be hostmessage without the ticket because it does not exist on the lookup.

index=net | rex "(?i)^([^:]*:){8}(?<CISCO_LOG>.*)$" | eval host_message=host+CISCO_LOG | lookup existing host_message |  eval hostTICKET=if(isnull(hostTICKET),host_message+" "+TICKET,host_message) | timechart count by hostTICKET
Tags (3)

Legend

You're using the wrong operator for performing string concatenations. It should be ".", not "+". So, your eval statement should read

eval hostTicket=if(isnull(hostTICKET),host_message." ".TICKET,host_message

SplunkTrust
SplunkTrust

Where is the field "hostTICKET" present? Its not coming from lookup right? Is it there in the logs?

0 Karma

Super Champion

No. NULL is being filled in by the lookup statement, so when it gets to the eval the values is NULL, which is not null.

0 Karma

Contributor

It is still coming back as NULL for messages that are not defined in the lookup. the field after "isnull" in parentheses is supposed to be the field that could come back as null correct?

0 Karma