<?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: Using the map command to match events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638810#M221342</link>
    <description>&lt;P&gt;So the subsearch has 14 results.&lt;BR /&gt;The first hit of the subsearch has 7 results on the main search.&lt;BR /&gt;But when I run the composed search with the subsearch in it I get 0 results.&lt;BR /&gt;&lt;BR /&gt;What's going on?&lt;/P&gt;</description>
    <pubDate>Wed, 05 Apr 2023 09:56:19 GMT</pubDate>
    <dc:creator>Ciarán</dc:creator>
    <dc:date>2023-04-05T09:56:19Z</dc:date>
    <item>
      <title>How to use the map command to match events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638383#M221252</link>
      <description>&lt;P&gt;Could someone have a look at the following query and see why it does not give me the results I expect based on the documentation of map?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=portal sourcetype=app:*** source="log" cls=c.b.m.s.SoapServiceClientService Exit event 'ERROR' 
| rex "(?i) .*? \[(?P&amp;lt;ResponseCode&amp;gt;\d+)(?=\])" 
| search ResponseCode=504 
| stats values(ses) as Session 
| map search="search index=portal sourcetype=app:*** source='log' cls='c.b.m.s.SoapClient Webservicecall*' ses=$Session$ | stats first"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So the first search lists all the session ID's for which a certain error occurs.&lt;BR /&gt;I want to match this to another event from those sessions which contains the name of the webservice for which the call failed.&lt;BR /&gt;The second search finds multiple events in the same session, but with 'stats first' I take the latest, which for now is assumed to be the failing one.&lt;BR /&gt;Instead of the events from the second search, I only get events for the first search as results. No table.&lt;BR /&gt;So right now my result are events which I would also get when removing the whole map bit and the first stats. Nothing seems to have been added in regards to fields.&lt;BR /&gt;&lt;BR /&gt;The holy grail would allow me to include two more rex commands in the map search to extract two fields. When I add a rex command comparable to the one in the first search, the second search won't run.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 11:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638383#M221252</guid>
      <dc:creator>Ciarán</dc:creator>
      <dc:date>2023-04-04T11:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638418#M221261</link>
      <description>&lt;P&gt;I think map may not be the solution to this problem.&amp;nbsp; Have you tried a subsearch?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=portal sourcetype=app:*** source='log' cls='c.b.m.s.SoapClient Webservicecall*' [
index=portal sourcetype=app:*** source="log" cls=c.b.m.s.SoapServiceClientService Exit event 'ERROR' 
| rex "(?i) .*? \[(?P&amp;lt;ResponseCode&amp;gt;\d+)(?=\])" 
| search ResponseCode=504 
| fields ses
| format ]&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 03 Apr 2023 15:47:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638418#M221261</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-04-03T15:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638778#M221323</link>
      <description>&lt;P&gt;Thanks for your advice.&lt;BR /&gt;Unfortunately I did not get any results with this query where I would expect 289 occurences of this in the time frame.&lt;BR /&gt;I therefor edited your query following what is done in Example 2 of&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.4/SearchTutorial/Useasubsearch" target="_blank"&gt;Use a subsearch - Splunk Documentation&lt;/A&gt;&amp;nbsp;but I still get no results.&lt;BR /&gt;The subsearch does return 289 results as expected.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=portal sourcetype=app:*** source='log' cls='c.b.m.s.SoapClient Webservicecall*' [
index=portal sourcetype=app:*** source="log" cls=c.b.m.s.SoapServiceClientService Exit event 'ERROR' 
| rex "(?i) .*? \[(?P&amp;lt;ResponseCode&amp;gt;\d+)(?=\])" 
| search ResponseCode=504 
| table ses ]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 Apr 2023 07:55:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638778#M221323</guid>
      <dc:creator>Ciarán</dc:creator>
      <dc:date>2023-04-05T07:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638787#M221325</link>
      <description>&lt;P&gt;I am assuming you corrected the syntax?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=portal sourcetype=app:*** source='log' cls='c.b.m.s.SoapClient Webservicecall*' [ search
index=portal sourcetype=app:*** source="log" cls=c.b.m.s.SoapServiceClientService Exit event 'ERROR' 
| rex "(?i) .*? \[(?P&amp;lt;ResponseCode&amp;gt;\d+)(?=\])" 
| search ResponseCode=504 
| table ses ]&lt;/LI-CODE&gt;&lt;P&gt;Using one of the values for ses returned by&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=portal sourcetype=app:*** source="log" cls=c.b.m.s.SoapServiceClientService Exit event 'ERROR' 
| rex "(?i) .*? \[(?P&amp;lt;ResponseCode&amp;gt;\d+)(?=\])" 
| search ResponseCode=504 
| table ses&lt;/LI-CODE&gt;&lt;P&gt;does&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=portal sourcetype=app:*** source='log' cls='c.b.m.s.SoapClient Webservicecall*' ses="value returned"&lt;/LI-CODE&gt;&lt;P&gt;return any results?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 08:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638787#M221325</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-04-05T08:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638790#M221328</link>
      <description>&lt;P&gt;I did fix the syntax &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Indeed it does not return any results and I have concluded that this might be because some application have not upgraded to the new logging standards so some expected logging is missing.&lt;BR /&gt;Testing it on a different timeframe in which I am sure there is a updated logging did work!&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 08:46:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638790#M221328</guid>
      <dc:creator>Ciarán</dc:creator>
      <dc:date>2023-04-05T08:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638795#M221333</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Oh no! I was too quick to reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So the loose queries work. Returning 7 events for any one session.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But the subsearch version does not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the end I would like to not have 7 events per session but the info from 1 specific event (the latest one from the x events).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 08:57:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638795#M221333</guid>
      <dc:creator>Ciarán</dc:creator>
      <dc:date>2023-04-05T08:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638801#M221335</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=portal sourcetype=app:*** source='log' cls='c.b.m.s.SoapClient Webservicecall*' [ search
index=portal sourcetype=app:*** source="log" cls=c.b.m.s.SoapServiceClientService Exit event 'ERROR' 
| rex "(?i) .*? \[(?P&amp;lt;ResponseCode&amp;gt;\d+)(?=\])" 
| search ResponseCode=504 
| dedup ses
| table ses ]
| sort 0 - _time
| dedup ses&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 Apr 2023 09:13:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638801#M221335</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-04-05T09:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the map command to match events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638804#M221338</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/255503"&gt;@Ciarán&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Could you please try below search? I think you can achieve your results without subsearch.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=portal sourcetype=app:*** source="log" cls=c.b.m.s.SoapServiceClientService Exit event 'ERROR' 
| rex "(?i) .*? \[(?P&amp;lt;ResponseCode&amp;gt;\d+)(?=\])" 
| stats first values(ResponseCode) as ResponseCodeList 
| search ResponseCodeList=504 
| rename first(*) as * 
| fields - ResponseCodeList&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 09:25:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638804#M221338</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2023-04-05T09:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638806#M221339</link>
      <description>&lt;P&gt;Thanks for thinking with me.&lt;BR /&gt;Could you give a bit more explanation with your query examples?&lt;BR /&gt;&lt;BR /&gt;Unfortunately this did not solve the problem.&lt;BR /&gt;&lt;BR /&gt;I have a subsearch result which does not contain duplicates. (it sometimes does, but right now it does not)&lt;BR /&gt;&lt;BR /&gt;The composed query with subsearch says it has zero results, so the sort and dedup seem useless?&lt;BR /&gt;&lt;BR /&gt;But to clarify my wishes. I need the latest event because the other results are not relevant to this search but I have no way to match them with the search other than they occur within a certain time frame before the error event. Will this sort and dedup give me the latest? Or does dedup result in a random event?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 09:37:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638806#M221339</guid>
      <dc:creator>Ciarán</dc:creator>
      <dc:date>2023-04-05T09:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the map command to match events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638808#M221340</link>
      <description>&lt;P&gt;Thanks for the suggestion, but I think you missed a part in my question.&lt;BR /&gt;If I am reading this query correctly it only searches in the events which have Exit event 'ERROR' , but the information I need (the webservice name) is not included in these events.&lt;BR /&gt;I need to find another event from the same session which occurred a little bit before the error event. That event does contain the name of the web service.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 09:43:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638808#M221340</guid>
      <dc:creator>Ciarán</dc:creator>
      <dc:date>2023-04-05T09:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638809#M221341</link>
      <description>&lt;P&gt;The subsearch essentially filters the base search by extending it with (( ses="xyz") OR (ses="abc"))&lt;/P&gt;&lt;P&gt;The dedup in the subsearch stops you getting ((ses="xyz") OR (ses="xyz") OR (ses="abc"))&lt;/P&gt;&lt;P&gt;The sort 0 - _time puts the result from the filtered base search in reverse chronological order&lt;/P&gt;&lt;P&gt;The dedup takes the first occurrence of each ses in the results (i.e. the latest by ses)&lt;/P&gt;&lt;P&gt;If there are no results, there is nothing to sort or dedup.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 09:52:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638809#M221341</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-04-05T09:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638810#M221342</link>
      <description>&lt;P&gt;So the subsearch has 14 results.&lt;BR /&gt;The first hit of the subsearch has 7 results on the main search.&lt;BR /&gt;But when I run the composed search with the subsearch in it I get 0 results.&lt;BR /&gt;&lt;BR /&gt;What's going on?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 09:56:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638810#M221342</guid>
      <dc:creator>Ciarán</dc:creator>
      <dc:date>2023-04-05T09:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638811#M221343</link>
      <description>&lt;P&gt;How many events are scanned (not returned) by the subsearch?&lt;/P&gt;&lt;P&gt;Subsearches are limited to 50,000 events - if you have more than 50,000 events returned by the initial search of the subsearch, your results are probably non-deterministic.&lt;/P&gt;&lt;P&gt;In this instance, you may need to break up your subsearch into multiple chunks.&lt;/P&gt;&lt;P&gt;You can test the theory by reducing the timescale of the search to see if that resolves the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 10:03:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638811#M221343</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-04-05T10:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638817#M221344</link>
      <description>&lt;P&gt;Thanks for another helping hand!&lt;BR /&gt;&lt;BR /&gt;So apparently the amount of events was not the issue. If I'm not mistaken I saw the number 38.000 something somewhere in the job inspect.&lt;BR /&gt;But the job inspection did tell me that it had trouble with the wild card in my main search. So I replaced that with a string match instead of a field match so I could circumvent the wild card and now it works!&lt;BR /&gt;&lt;BR /&gt;Thanks so much!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 11:00:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638817#M221344</guid>
      <dc:creator>Ciarán</dc:creator>
      <dc:date>2023-04-05T11:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using the map command to match events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638819#M221346</link>
      <description>&lt;P&gt;It is often good to look at what the job inspector is telling you, it is not just for show&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 11:05:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-map-command-to-match-events/m-p/638819#M221346</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-04-05T11:05:30Z</dc:date>
    </item>
  </channel>
</rss>

