<?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 regex to extract summary in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685957#M234054</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\"changes\":(?&amp;lt;changes&amp;gt;\{.*?\}\})"&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 30 Apr 2024 11:15:46 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-04-30T11:15:46Z</dc:date>
    <item>
      <title>Using regex to extract summary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685888#M234020</link>
      <description>&lt;P&gt;in raw data I have portion that I would like to use in report.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;"changes":{"description":{"before":"&amp;lt;some text or empty&amp;gt;","after":"&amp;lt;some text or empty&amp;gt;"}}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I created&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;rex summary= "changes":\{"description":\{"before":"&amp;lt;some text or empty&amp;gt;","after":"&amp;lt;some text or empty&amp;gt;"\}\})"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;But it doesn't work.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please advise&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 21:48:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685888#M234020</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-29T21:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex to extract summary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685897#M234023</link>
      <description>&lt;P&gt;This is not how rex works - you need to provide a pattern as a regular expression to identify what you want to extract. For example, do you want everything from "change" to "}}"? Does this pattern hold true for all your event where you want to extract this field?&lt;/P&gt;&lt;P&gt;Aside from that, this looks like json - why aren't you using spath or the other json functions to extract the json field?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 22:26:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685897#M234023</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-29T22:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex to extract summary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685918#M234036</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235910"&gt;@bigll&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;said, this seems to be a json format so the INDEXED_ENTRACTION = json option in props.conf or the spath command (&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Spath" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Spath&lt;/A&gt;) is the easiest solution to your requirement.&lt;/P&gt;&lt;P&gt;Then the rex command has a different format to extract fields: the fied definition must be located inside the rex definition, as the following example using your data:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "before\":\"(?&amp;lt;summary_before&amp;gt;[^\"]+)\".\"after\":\"(?&amp;lt;summary_after&amp;gt;[^\"]+)"&lt;/LI-CODE&gt;&lt;P&gt;You can see how to extract and test your regex at&amp;nbsp;&lt;A href="https://regex101.com/r/22aHz1/1" target="_blank"&gt;https://regex101.com/r/22aHz1/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 05:28:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685918#M234036</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-04-30T05:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex to extract summary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685956#M234053</link>
      <description>&lt;P&gt;Thank you for your message.&lt;BR /&gt;&lt;BR /&gt;You are correct, I need everything between {} as a value of the field I can include in the table.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 11:05:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685956#M234053</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-30T11:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex to extract summary</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685957#M234054</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\"changes\":(?&amp;lt;changes&amp;gt;\{.*?\}\})"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 30 Apr 2024 11:15:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-to-extract-summary/m-p/685957#M234054</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-30T11:15:46Z</dc:date>
    </item>
  </channel>
</rss>

