<?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: Query for different lines with status in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568366#M198063</link>
    <description>&lt;P&gt;I need 2 columns because I have to analyze if the cod changed status.&lt;/P&gt;&lt;P&gt;Cod 600 is processing and 900 is processed. I need this view in a table.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Sep 2021 11:56:59 GMT</pubDate>
    <dc:creator>graziaedu</dc:creator>
    <dc:date>2021-09-24T11:56:59Z</dc:date>
    <item>
      <title>Query for different lines with status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568309#M198038</link>
      <description>&lt;P&gt;I have a log as a below&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;cod:5678,status:600&lt;BR /&gt;cod:9012,staus:600&lt;BR /&gt;cod:1234,status:600&lt;BR /&gt;cod: 1234,status:900&lt;BR /&gt;cod:4987,status:600&lt;BR /&gt;cod:4987,status:900&lt;BR /&gt;cod:3655,status:600&lt;BR /&gt;cod:3655,status:900&lt;/P&gt;&lt;P&gt;I need a query that give me this result&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;cod&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;status1&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;status2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;1234&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;600&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;900&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;5678&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;600&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;9012&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;600&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;4987&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;600&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;900&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;3655&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;600&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;900&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can i write a query for this?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 20:46:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568309#M198038</guid>
      <dc:creator>graziaedu</dc:creator>
      <dc:date>2021-09-23T20:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Query for different lines with status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568324#M198041</link>
      <description>&lt;P&gt;What if for a given value of cod you had just status=900?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 05:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568324#M198041</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-24T05:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Query for different lines with status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568343#M198048</link>
      <description>&lt;P&gt;I have 900 only if I have 600.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 09:03:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568343#M198048</guid>
      <dc:creator>graziaedu</dc:creator>
      <dc:date>2021-09-24T09:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Query for different lines with status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568355#M198054</link>
      <description>&lt;P&gt;OK. So why not just list the max value? (either the 600 or 900)&lt;/P&gt;&lt;P&gt;Of course you can do it in two columns but it's much easier to just&lt;/P&gt;&lt;PRE&gt;| stats max(status) by cod&lt;/PRE&gt;&lt;P&gt;than to try to combine the values, then split them into different columns.&lt;/P&gt;&lt;P&gt;It is of course possible, but this one is way, way simpler&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 10:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568355#M198054</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-24T10:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Query for different lines with status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568366#M198063</link>
      <description>&lt;P&gt;I need 2 columns because I have to analyze if the cod changed status.&lt;/P&gt;&lt;P&gt;Cod 600 is processing and 900 is processed. I need this view in a table.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 11:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568366#M198063</guid>
      <dc:creator>graziaedu</dc:creator>
      <dc:date>2021-09-24T11:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Query for different lines with status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568387#M198073</link>
      <description>&lt;P&gt;I don't get it. You say that there's no possiblity that you have just 900, without 600. So if you have 600 as the result, it's still processing. If 900 - it's finished (must have been 600 previously, but now you have both events)&lt;/P&gt;&lt;P&gt;As I said - it's possible to do it in two columns but it's just an overkill and unnecessary complication.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 13:05:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568387#M198073</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-24T13:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Query for different lines with status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568392#M198075</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235207"&gt;@graziaedu&lt;/a&gt;&amp;nbsp;How actually you are looking for results ? if status1 is 600 then status2 should also be 600 ? am i getting this right ?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 13:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568392#M198075</guid>
      <dc:creator>ashvinpandey</dc:creator>
      <dc:date>2021-09-24T13:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Query for different lines with status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568435#M198093</link>
      <description>&lt;P&gt;OK, so assuming you strictly interpret the need here, and assume that it's only values of 600 and 900 and no others, and I took out one 600-value from the test data I built so I could confirm that if there's a 900 and NOT a 600, that it does what I expected.&lt;/P&gt;&lt;P&gt;Then, with those caveats and this fragility, one could do the last two lines here.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval testdata = "cod:5678,status:600XXcod:9012,status:600Xcod:1234,status:600Xcod: 1234,status:900Xcod:4987,status:600Xcod:4987,status:900Xcod:3655,status:900"
| makemv testdata delim="X"
| mvexpand testdata
| rex field=testdata "cod:\s*(?&amp;lt;cod&amp;gt;[^,]*),status:\s*(?&amp;lt;status&amp;gt;\d*)"
| chart values(status) over cod by status
| rename 600 AS Status1, 900 AS Status2&lt;/LI-CODE&gt;&lt;P&gt;WHERE - the first 5 lines (run them all by themselves!) are just to build a test data set as a run-anywhere search.&lt;/P&gt;&lt;P&gt;The chart command and the rename command - the last two lines - are the ones that do the work.&lt;/P&gt;&lt;P&gt;And it assumes you have this data ingested in a way there are two fields for each record - a cod field and a status field.&amp;nbsp; Otherwise, really, you should go back and reingest the data and set that up.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 19:11:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-for-different-lines-with-status/m-p/568435#M198093</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2021-09-24T19:11:46Z</dc:date>
    </item>
  </channel>
</rss>

