<?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 Re: How to check if field exists and bring another field if true in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588229#M204853</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp; but didn't work... brings me event_type for all records, even the record with payload.rule_description&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fpedrosa_0-1646831301179.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18392i0D25E14E8B0B987A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fpedrosa_0-1646831301179.png" alt="fpedrosa_0-1646831301179.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Mar 2022 13:08:54 GMT</pubDate>
    <dc:creator>fpedrosa</dc:creator>
    <dc:date>2022-03-09T13:08:54Z</dc:date>
    <item>
      <title>How to check if field exists and bring another field if true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588220#M204848</link>
      <description>&lt;P&gt;Hi, I have this search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath 
| rename object.* as *
| spath path=events{} output=events
| stats by timestamp, events, application, event_type, account_id, context.display_name,
| mvexpand events
| eval _raw=events
| kv
| table timestamp, payload.rule_description,  "context.display_name",  account_id, "event_type", "application", "payload.rule_url"
| rename account_id as "Account ID", timestamp as "Timestamp", context.display_name as "System", context.host_url as "Host URL", event_type as "Event Type", "title" as "Title", "application" as "Application",  "payload.rule_url" as "URL"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;I have a json with multiple `events,&amp;nbsp; inside this event&amp;nbsp; I have "payload.rule_description", but, some record, doesn't have this "payload.rule_description" object, so, I don't have the "payload.rule_description".&lt;BR /&gt;&lt;BR /&gt;How can I check if the record has the "payload.rule_description" if not, brings `event_type`&amp;nbsp; instead?&lt;BR /&gt;&lt;BR /&gt;Tried to use `eval title=if(payload.rule_description, payload.rule_description, event_type)`&amp;nbsp; doesn't work.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 12:02:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588220#M204848</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-03-09T12:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if field exists and bring another field if true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588224#M204851</link>
      <description>&lt;PRE&gt;| eval title=coalesce(payload.rule_description,eventtype)&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Mar 2022 12:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588224#M204851</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-09T12:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if field exists and bring another field if true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588229#M204853</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp; but didn't work... brings me event_type for all records, even the record with payload.rule_description&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fpedrosa_0-1646831301179.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18392i0D25E14E8B0B987A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fpedrosa_0-1646831301179.png" alt="fpedrosa_0-1646831301179.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588229#M204853</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-03-09T13:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if field exists and bring another field if true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588235#M204854</link>
      <description>&lt;P&gt;Ahh, right. You have a dot in your field name. In such case (non alphanumerical characters in field name) you have to put the field name in single quotes.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;| eval title=coalesce('payload.rule_description',eventtype)&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:35:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588235#M204854</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-09T13:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if field exists and bring another field if true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588236#M204855</link>
      <description>&lt;P&gt;Thanks again, unfortunately still the same... here is my search:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath 
| rename object.* as *
| spath path=events{} output=events
| stats by timestamp, events, application, event_type, account_id, context.display_name,
| mvexpand events 
| eval _raw=events
| eval title=coalesce('payload.rule_description', event_type) 
| kv
| table timestamp, title,  "context.display_name",  account_id, "event_type", "application", "payload.rule_url"
| rename account_id as "Account ID", timestamp as "Timestamp", context.display_name as "System", context.host_url as "Host URL", event_type as "Event Type", "title" as "Title", "application" as "Application",  "payload.rule_url" as "URL"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:39:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588236#M204855</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-03-09T13:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if field exists and bring another field if true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588237#M204856</link>
      <description>&lt;P&gt;But you're evaluating this too early. You have to do it after kv. Before kv you don't have values in your fields.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:52:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588237#M204856</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-09T13:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if field exists and bring another field if true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588238#M204857</link>
      <description>&lt;P&gt;You are right!! Works now! Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588238#M204857</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-03-09T13:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if field exists and bring another field if true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588240#M204858</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&amp;nbsp; do you know how I can get the array index for the json?&amp;nbsp; for example, with my search, I'll split the `events`&amp;nbsp; array into a new record, but I need to know the index of the original event, so I can grab it when I'll develop row expansion, to show more data.&lt;BR /&gt;&lt;BR /&gt;Do you know how to do this?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 14:06:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-check-if-field-exists-and-bring-another-field-if-true/m-p/588240#M204858</guid>
      <dc:creator>fpedrosa</dc:creator>
      <dc:date>2022-03-09T14:06:48Z</dc:date>
    </item>
  </channel>
</rss>

