<?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 can I use rex to dedup and extract certain data from a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429199#M122778</link>
    <description>&lt;P&gt;like that?&lt;BR /&gt;
&lt;CODE&gt;.... | rex field=params "\{"id"=&amp;gt;"(?&amp;lt;article_number&amp;gt;\d+)"&lt;/CODE&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
    <pubDate>Wed, 29 Aug 2018 00:25:56 GMT</pubDate>
    <dc:creator>adonio</dc:creator>
    <dc:date>2018-08-29T00:25:56Z</dc:date>
    <item>
      <title>How can I use rex to dedup and extract certain data from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429198#M122777</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am new to using &lt;CODE&gt;rex&lt;/CODE&gt; and &lt;CODE&gt;extract&lt;/CODE&gt;. I am trying to come up with a regex to extract certain data from a field only if that field exists.&lt;/P&gt;

&lt;P&gt;Like in this query&lt;BR /&gt;
[&amp;#27;[0;37m2018-08-28 22:40:32.999&amp;#27;[0m] &amp;#27;[32mINFO &amp;#27;[0m [pid:27567] [request_id:xxxxxxxx] [host:xxxxxxx] [remote_ip:xxxxx] [session_id:xxxxxxxx] [auth_id:] method=GET path=/questions/2044288 format=html controller=questions action=show status=410 duration=130.55 view=118.49 db=1.78 &lt;STRONG&gt;params={"id"=&amp;gt;"2044288"}&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I am trying to extract the id number from params field and export it as article_number field. Can somebody help me how do I remove duplicates and use rex with extract?&lt;/P&gt;

&lt;P&gt;So far I came up with &lt;STRONG&gt;index="cto-lc-app-prdidx" status=410 path="&lt;EM&gt;" params="&lt;/EM&gt;" | dedup path,params | rex field=params ""&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
-Ameya&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:03:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429198#M122777</guid>
      <dc:creator>ameyapatil29</dc:creator>
      <dc:date>2020-09-29T21:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use rex to dedup and extract certain data from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429199#M122778</link>
      <description>&lt;P&gt;like that?&lt;BR /&gt;
&lt;CODE&gt;.... | rex field=params "\{"id"=&amp;gt;"(?&amp;lt;article_number&amp;gt;\d+)"&lt;/CODE&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 00:25:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429199#M122778</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-08-29T00:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use rex to dedup and extract certain data from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429200#M122779</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/137854"&gt;@ameyapatil29&lt;/a&gt;,&lt;/P&gt;

&lt;P&gt;try to use the following query to do it. I've tested it and it works.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;yoursearch | rex  field=params "params={\"id\"=\&amp;gt;\"(?&amp;lt;article_number&amp;gt;[^\"]+)\"" | dedup article_number&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;First you are extracting the article_number from each logfile. After that you are removing duplicated article_numbers. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429200#M122779</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2020-09-29T21:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use rex to dedup and extract certain data from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429201#M122780</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "\"id\"\=\&amp;gt;\"(?&amp;lt;article_number&amp;gt;\d+)\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Aug 2018 21:30:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-rex-to-dedup-and-extract-certain-data-from-a-field/m-p/429201#M122780</guid>
      <dc:creator>nawazns5038</dc:creator>
      <dc:date>2018-08-31T21:30:06Z</dc:date>
    </item>
  </channel>
</rss>

