<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Asset lookup with conditional eval in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Asset-lookup-with-conditional-eval/m-p/459048#M6570</link>
    <description>&lt;P&gt;Greetings--&lt;BR /&gt;
I have an asset lookup gen that begins with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats latest(src_ip) as ip latest(os) as os **latest(primary_user) as owner latest(user_name) as user** latest(src_mac) as mac by client_name
| rex field=client_name "^[^\.]+\.(?P&amp;lt;dest_domain&amp;gt;.+)"
| rex field=client_name "^(?&amp;lt;nt_host&amp;gt;[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, out asset lookup fields do not contain "user":&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/ES/5.3.0/Admin/Formatassetoridentitylist" target="_blank"&gt;https://docs.splunk.com/Documentation/ES/5.3.0/Admin/Formatassetoridentitylist&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;ip,mac,nt_host,dns,owner,priority,lat,long,city,country,bunit,category,pci_domain,is_expected,should_timesync,should_update,requires_av&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;When I try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval src="1.2.3.4" | get_asset(src)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It automatically puts primary_user as the owner.&lt;BR /&gt;
However, I would ideally like it to:&lt;BR /&gt;
Assign latest(user_name) as owner and if latest(user_name)=null, then assign latest(primary_user) as owner, and if both are $null, then to make owner default to "unknown"&lt;/P&gt;

&lt;P&gt;I'm not sure how to include the eval latest() inside of |eval owner= case(...), etc.&lt;BR /&gt;
Any advice would be greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 01:12:38 GMT</pubDate>
    <dc:creator>richardphung</dc:creator>
    <dc:date>2020-09-30T01:12:38Z</dc:date>
    <item>
      <title>Asset lookup with conditional eval</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Asset-lookup-with-conditional-eval/m-p/459048#M6570</link>
      <description>&lt;P&gt;Greetings--&lt;BR /&gt;
I have an asset lookup gen that begins with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats latest(src_ip) as ip latest(os) as os **latest(primary_user) as owner latest(user_name) as user** latest(src_mac) as mac by client_name
| rex field=client_name "^[^\.]+\.(?P&amp;lt;dest_domain&amp;gt;.+)"
| rex field=client_name "^(?&amp;lt;nt_host&amp;gt;[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, out asset lookup fields do not contain "user":&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/ES/5.3.0/Admin/Formatassetoridentitylist" target="_blank"&gt;https://docs.splunk.com/Documentation/ES/5.3.0/Admin/Formatassetoridentitylist&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;ip,mac,nt_host,dns,owner,priority,lat,long,city,country,bunit,category,pci_domain,is_expected,should_timesync,should_update,requires_av&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;When I try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval src="1.2.3.4" | get_asset(src)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It automatically puts primary_user as the owner.&lt;BR /&gt;
However, I would ideally like it to:&lt;BR /&gt;
Assign latest(user_name) as owner and if latest(user_name)=null, then assign latest(primary_user) as owner, and if both are $null, then to make owner default to "unknown"&lt;/P&gt;

&lt;P&gt;I'm not sure how to include the eval latest() inside of |eval owner= case(...), etc.&lt;BR /&gt;
Any advice would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:12:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Asset-lookup-with-conditional-eval/m-p/459048#M6570</guid>
      <dc:creator>richardphung</dc:creator>
      <dc:date>2020-09-30T01:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Asset lookup with conditional eval</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Asset-lookup-with-conditional-eval/m-p/459049#M6571</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|eval owner=if(isnotnull('user_name'),'user_name',(if(isnotnull('primary_user'),'primary_user',"unknown")))
| stats latest(src_ip) as ip latest(os) as os latest(owner) as owner latest(src_mac) as mac by client_name
| rex field=client_name "^[^\.]+\.(?P&amp;lt;dest_domain&amp;gt;.+)"
| rex field=client_name "^(?&amp;lt;nt_host&amp;gt;[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2019 23:18:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Asset-lookup-with-conditional-eval/m-p/459049#M6571</guid>
      <dc:creator>marycordova</dc:creator>
      <dc:date>2019-07-10T23:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Asset lookup with conditional eval</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Asset-lookup-with-conditional-eval/m-p/459050#M6572</link>
      <description>&lt;P&gt;This worked perfectly.&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 17:13:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Asset-lookup-with-conditional-eval/m-p/459050#M6572</guid>
      <dc:creator>richardphung</dc:creator>
      <dc:date>2019-07-11T17:13:33Z</dc:date>
    </item>
  </channel>
</rss>

