<?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: set a flag in based on field value in multiple row in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/set-a-flag-in-based-on-field-value-in-multiple-row/m-p/686827#M234249</link>
    <description>&lt;P&gt;There are a number of ways to do this - the example below uses&amp;nbsp;&lt;STRONG&gt;makeresults&lt;/STRONG&gt; to create your example data&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simple way 1 - use eventstats to collect all networks for each server and then check if the results contain fw-network-X where X is the network the server is on&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="server,network,firewall
server-1,network-1,yes
server-1,fw-network-1,yes
server-2,network-2,no
server-3,network-1,yes
server-3,fw-network-1,yes
server-4,network-2,no
server-5,network-3,yes
server-5,fw-network-3,yes"
| fields - firewall
``` Above creates your example table ```
| eventstats values(network) as nws by server
| eval firewall=if(nws="fw-".network OR match(network,"^fw-"), "yes", "no")
| fields - nws
| table server network firewall&lt;/LI-CODE&gt;&lt;P&gt;Depending on the subleties of your data, you may need to tweak the &lt;STRONG&gt;eval firewall&lt;/STRONG&gt; statement&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2024 03:45:48 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2024-05-08T03:45:48Z</dc:date>
    <item>
      <title>set a flag in based on field value in multiple row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/set-a-flag-in-based-on-field-value-in-multiple-row/m-p/686820#M234245</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;How do I&amp;nbsp;set a flag in based on field value in multiple row?&lt;BR /&gt;For example:&lt;BR /&gt;In the following table,&amp;nbsp; network-1 is set to yes because server-1 that is on &lt;STRONG&gt;network-1&lt;/STRONG&gt; is also on &lt;STRONG&gt;fw-network-1&lt;/STRONG&gt; that is behind a firewall.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Please suggest. Thank you!!&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE width="310"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="101"&gt;&lt;STRONG&gt;server&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="111"&gt;&lt;STRONG&gt;network&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="98"&gt;&lt;STRONG&gt;firewall&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;server-1&lt;/TD&gt;&lt;TD&gt;network-1&lt;/TD&gt;&lt;TD&gt;yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;server-1&lt;/TD&gt;&lt;TD&gt;fw-network-1&lt;/TD&gt;&lt;TD&gt;yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;server-2&lt;/TD&gt;&lt;TD&gt;network-2&lt;/TD&gt;&lt;TD&gt;no&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;server-3&lt;/TD&gt;&lt;TD&gt;network-1&lt;/TD&gt;&lt;TD&gt;yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;server-3&lt;/TD&gt;&lt;TD&gt;fw-network-1&lt;/TD&gt;&lt;TD&gt;yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;server-4&lt;/TD&gt;&lt;TD&gt;network-2&lt;/TD&gt;&lt;TD&gt;no&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;server-5&lt;/TD&gt;&lt;TD&gt;network-3&lt;/TD&gt;&lt;TD&gt;yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;server-5&lt;/TD&gt;&lt;TD&gt;fw-network-3&lt;/TD&gt;&lt;TD&gt;yes&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 08 May 2024 02:10:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/set-a-flag-in-based-on-field-value-in-multiple-row/m-p/686820#M234245</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2024-05-08T02:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: set a flag in based on field value in multiple row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/set-a-flag-in-based-on-field-value-in-multiple-row/m-p/686827#M234249</link>
      <description>&lt;P&gt;There are a number of ways to do this - the example below uses&amp;nbsp;&lt;STRONG&gt;makeresults&lt;/STRONG&gt; to create your example data&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simple way 1 - use eventstats to collect all networks for each server and then check if the results contain fw-network-X where X is the network the server is on&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="server,network,firewall
server-1,network-1,yes
server-1,fw-network-1,yes
server-2,network-2,no
server-3,network-1,yes
server-3,fw-network-1,yes
server-4,network-2,no
server-5,network-3,yes
server-5,fw-network-3,yes"
| fields - firewall
``` Above creates your example table ```
| eventstats values(network) as nws by server
| eval firewall=if(nws="fw-".network OR match(network,"^fw-"), "yes", "no")
| fields - nws
| table server network firewall&lt;/LI-CODE&gt;&lt;P&gt;Depending on the subleties of your data, you may need to tweak the &lt;STRONG&gt;eval firewall&lt;/STRONG&gt; statement&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 03:45:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/set-a-flag-in-based-on-field-value-in-multiple-row/m-p/686827#M234249</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-05-08T03:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: set a flag in based on field value in multiple row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/set-a-flag-in-based-on-field-value-in-multiple-row/m-p/686926#M234285</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks a lot!!&amp;nbsp; You rock!!&amp;nbsp;&amp;nbsp;&lt;BR /&gt;I did make attempt on using evenstats, but then It didn't work because of&amp;nbsp; if condition didn't work.&amp;nbsp; It turns out I had to use a match command.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;I appreciate your help.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 20:20:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/set-a-flag-in-based-on-field-value-in-multiple-row/m-p/686926#M234285</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2024-05-08T20:20:42Z</dc:date>
    </item>
  </channel>
</rss>

