<?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: Should be simple but it's not for me regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Should-be-simple-but-it-s-not-for-me-regex/m-p/674873#M230986</link>
    <description>&lt;P&gt;argh!!!&amp;nbsp; Stupid me forgot the field argument.......&amp;nbsp; Now it works, sorry everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jan 2024 19:11:17 GMT</pubDate>
    <dc:creator>dcase9999</dc:creator>
    <dc:date>2024-01-19T19:11:17Z</dc:date>
    <item>
      <title>Should be simple but it's not for me regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Should-be-simple-but-it-s-not-for-me-regex/m-p/674868#M230985</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below string and I'm trying to extract out the downstream status code by using this expression.&amp;nbsp; I used to do this a long time ago but it appears those brain cells have aged out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regex that works in regex 101 but not Splunk&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rex "DownstreamStatus..(?&amp;lt;dscode&amp;gt;\d+)"|stats count by dscode&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;String&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; {"ClientAddr":"blah","ClientHost":"blah","ClientPort":"50721","ClientUsername":"-","DownstreamContentSize":11,"DownstreamStatus":502,"Duration":179590376953,"OriginContentSize":11,"OriginDuration":179590108721,"OriginStatus":502,"Overhead":268232,&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 18:27:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Should-be-simple-but-it-s-not-for-me-regex/m-p/674868#M230985</guid>
      <dc:creator>dcase9999</dc:creator>
      <dc:date>2024-01-19T18:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Should be simple but it's not for me regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Should-be-simple-but-it-s-not-for-me-regex/m-p/674873#M230986</link>
      <description>&lt;P&gt;argh!!!&amp;nbsp; Stupid me forgot the field argument.......&amp;nbsp; Now it works, sorry everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 19:11:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Should-be-simple-but-it-s-not-for-me-regex/m-p/674873#M230986</guid>
      <dc:creator>dcase9999</dc:creator>
      <dc:date>2024-01-19T19:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Should be simple but it's not for me regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Should-be-simple-but-it-s-not-for-me-regex/m-p/674904#M230991</link>
      <description>&lt;P&gt;Although you can get rex to work to some extent, treating structure data such as JSON as string is not robust. &amp;nbsp;I always recommend changing to Splunk's tested builtin functions such as &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;spath&lt;/A&gt;&amp;nbsp;or &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fromjson" target="_blank" rel="noopener"&gt;fromjson&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;If your event is JSON, Splunk should have given you the data field unless there's some serious problem with event parsing. &amp;nbsp;If the string snippet is part of a data field that contains compliant JSON, say data, just do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath input=data&lt;/LI-CODE&gt;&lt;P&gt;If the snippet is not in a field yet, use rex to extract the entire compliant JSON, then use spath. &amp;nbsp;You will have much better data to work with.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 22:18:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Should-be-simple-but-it-s-not-for-me-regex/m-p/674904#M230991</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-01-19T22:18:04Z</dc:date>
    </item>
  </channel>
</rss>

