<?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 Splunk Query to extract id's from a event and display the ID's in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741048#M240535</link>
    <description>&lt;P&gt;Below is the search and I need to extract the ID's shown in the below event and there are also many other ID's. Please help me in writing a query to extract the ID's which starts with "Duplicate Id's that needs to be displayed ::::::[&lt;SPAN class=""&gt;6523409&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;6529865]" in the log file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index="*" source ="*"&amp;nbsp; "Duplicate Id's that needs to be displayed ::::::&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;6523409&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;6529865]&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Mar 2025 20:26:13 GMT</pubDate>
    <dc:creator>Vin</dc:creator>
    <dc:date>2025-03-06T20:26:13Z</dc:date>
    <item>
      <title>Splunk Query to extract id's from a event and display the ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741048#M240535</link>
      <description>&lt;P&gt;Below is the search and I need to extract the ID's shown in the below event and there are also many other ID's. Please help me in writing a query to extract the ID's which starts with "Duplicate Id's that needs to be displayed ::::::[&lt;SPAN class=""&gt;6523409&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;6529865]" in the log file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index="*" source ="*"&amp;nbsp; "Duplicate Id's that needs to be displayed ::::::&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;6523409&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;6529865]&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 20:26:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741048#M240535</guid>
      <dc:creator>Vin</dc:creator>
      <dc:date>2025-03-06T20:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query to extract id's from a event and display the ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741049#M240536</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242595"&gt;@Vin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please could you share some of your raw events so that we can help you further?&lt;/P&gt;&lt;P&gt;In the meantime, you might have some success with something like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=_raw max_match=0 "(?&amp;lt;numbers&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;Please let me know how you get on and consider adding karma to this or any other answer if it has helped.&lt;BR /&gt;Regards&lt;/P&gt;&lt;P&gt;Will&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 21:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741049#M240536</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-03-06T21:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query to extract id's from a event and display the ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741077#M240546</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242595"&gt;@Vin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;it's really difficoult to create a regex without a data sample!&lt;/P&gt;&lt;P&gt;anyway, if the ID to extract is the number in the square brackets and you have only one copuple of square brackets you could use this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\[(?&amp;lt;your_field&amp;gt;[^\]]+)"&lt;/LI-CODE&gt;&lt;P&gt;I could be more sure if you can share some data.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 07:20:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741077#M240546</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-03-07T07:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query to extract id's from a event and display the ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741115#M240552</link>
      <description>&lt;P&gt;As others already pointed out - what data you're searching?&lt;/P&gt;&lt;P&gt;Also, searching across all events from all indexes will be slooooooow. You should limit your search as early as possible.&lt;/P&gt;&lt;P&gt;But the main issue is - what actually is your problem? You seem to have some search which doesn't actually search for anything, just lists all events. And you want to "display duplicate ids". Do you have statically defined ids? Or do you want to extract the ids from your data and find any that are duplicate? Be more verbose about your problem.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 12:54:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741115#M240552</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-03-07T12:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query to extract id's from a event and display the ID's</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741255#M240563</link>
      <description>&lt;P&gt;I know it's already a party. &amp;nbsp;But I have to agree with&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;that throwing out a random SPL snippet is not a good way to use volunteers' time. &amp;nbsp;Here are four golden rules of asking an answerable question that I call four commandments:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Illustrate data input (in raw text, anonymize as needed), whether they are raw events or output from a search (SPL that volunteers here do not have to look at).&lt;/LI&gt;&lt;LI&gt;Illustrate the desired output from illustrated data.&lt;/LI&gt;&lt;LI&gt;Explain the logic between illustrated data and desired output&amp;nbsp;&lt;EM&gt;without&lt;/EM&gt;&amp;nbsp;SPL.&lt;/LI&gt;&lt;LI&gt;If you also illustrate attempted SPL, illustrate actual output and compare with desired output, explain why they look different&amp;nbsp;&lt;U&gt;to you&lt;/U&gt;&amp;nbsp;if that is not painfully obvious.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In this spirit, if I have to read your mind, I will start by reverse engineering what your data look like: Some your raw data contains text strings like&amp;nbsp;&lt;SPAN&gt;"&lt;U&gt;Duplicate Id's that needs to be displayed ::::::[&lt;/U&gt;&lt;/SPAN&gt;&lt;U&gt;&lt;SPAN class=""&gt;6523409&lt;/SPAN&gt;, &lt;/U&gt;&lt;SPAN class=""&gt;&lt;U&gt;6529865]&lt;/U&gt;". &amp;nbsp;Given such an event, the desired output is a multivalue field containing values&lt;/SPAN&gt;&amp;nbsp;6523409 and6529865. &amp;nbsp;Let us call this field "duplicate_ids". &amp;nbsp;Something to this effect:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;duplicate_ids&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;blah, blah, blah Duplicate Id's that needs to be displayed ::::::[6523409, 6529865] - and more blahs&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;6523409&lt;/DIV&gt;&lt;DIV class=""&gt;6529865&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Is this the use case? &amp;nbsp;If yes, here is what I do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "Duplicate Id's that needs to be displayed :*(?&amp;lt;duplicate_ids&amp;gt;\[[^\]]+\])"
| eval duplicate_ids = json_array_to_mv(duplicate_ids)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(The above requires Splunk 8.1 or later. &amp;nbsp;But it is not the only way to do this.)&lt;/P&gt;&lt;P&gt;Here is an emulation for you to play with and compare with real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| fields - _time
| eval _raw = "blah, blah, blah Duplicate Id's that needs to be displayed ::::::[6523409, 6529865] - and more blahs"
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2025 04:19:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-to-extract-id-s-from-a-event-and-display-the-ID-s/m-p/741255#M240563</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-03-10T04:19:35Z</dc:date>
    </item>
  </channel>
</rss>

