<?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: Proper Rex expression help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712501#M240348</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/262853"&gt;@nkavouris&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;what's the behavior of this regex: it extract too data or nothing?&lt;/P&gt;&lt;P&gt;it seems to be correct using the sample you shared.&lt;/P&gt;&lt;P&gt;Anyway, this seems to be a log in json format, did you tried to use INDEXED_EXTRACTIONS=JSON or spath?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2025 16:44:26 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2025-02-25T16:44:26Z</dc:date>
    <item>
      <title>Proper Rex expression help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712498#M240345</link>
      <description>&lt;P&gt;I need help building a proper rex expression to extract the bold text from the following raw data&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;{"&lt;/SPAN&gt;&lt;SPAN class=""&gt;bootcount&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:8&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;&lt;SPAN class=""&gt;device_id&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;environment&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;prod_walker&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;event_source&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;appliance&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;event_type&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;GENERIC&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;local_time&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;2025-02-20T00:34:58.406-06:00&lt;/SPAN&gt;&lt;SPAN&gt;",&lt;BR /&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;location&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;{"&lt;/SPAN&gt;&lt;SPAN class=""&gt;city&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;country&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;latitude&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:XXXX&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;&lt;SPAN class=""&gt;longitude&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:XXXX&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;&lt;SPAN class=""&gt;state&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;"},"&lt;/SPAN&gt;&lt;SPAN class=""&gt;log_level&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;info&lt;/SPAN&gt;&lt;SPAN&gt;",&lt;BR /&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;message&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;martini::hardware_controller:&lt;/SPAN&gt; Unit &lt;SPAN class=""&gt;state&lt;/SPAN&gt; &lt;SPAN class=""&gt;update&lt;/SPAN&gt; &lt;SPAN class=""&gt;from&lt;/SPAN&gt; &lt;SPAN class=""&gt;cook&lt;/SPAN&gt; &lt;SPAN class=""&gt;client&lt;/SPAN&gt; &lt;SPAN class=""&gt;target:&lt;/SPAN&gt; &lt;SPAN class=""&gt;Elements&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;temp:&lt;/SPAN&gt; &lt;SPAN class=""&gt;500&lt;/SPAN&gt;&lt;SPAN class=""&gt;°&lt;/SPAN&gt;&lt;SPAN class=""&gt;F&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;F:&lt;/SPAN&gt; &lt;SPAN class=""&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;]), &lt;/SPAN&gt;&lt;SPAN class=""&gt;hw_state:&lt;/SPAN&gt; &lt;SPAN class=""&gt;Elements&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;temp:&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN class=""&gt;500&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;°&lt;/SPAN&gt;&lt;SPAN class=""&gt;F&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;F:&lt;/SPAN&gt; &lt;SPAN class=""&gt;115&lt;/SPAN&gt;&lt;SPAN&gt;])&lt;/SPAN&gt;&lt;SPAN class=""&gt;\u0000&lt;/SPAN&gt;&lt;SPAN&gt;",&lt;BR /&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;model_number&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"XXXX&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;sequence&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:372246&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;&lt;SPAN class=""&gt;serial&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;XXXX&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;software_version&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;2.3.0.276&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class=""&gt;ticks&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:0&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;&lt;SPAN class=""&gt;timestamp&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:1740033298&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;&lt;SPAN class=""&gt;timestamp_ms&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:1740033298406}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have tried;&lt;/P&gt;&lt;PRE&gt;rex field=message "(?=[^h]*(?:hw_state:|h.*hw_state:))^(?:[^\(\n]*\(){2}\w+:\s+(?P&amp;lt;set_temp&amp;gt;\d+)&lt;BR /&gt;rex field=message ".*hw_state: Elements\(temp:(?&amp;lt;set_temp&amp;gt;\d+),.*"|&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;with no results yielded. What is the proper rex expression to extract 500 from the message field&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:27:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712498#M240345</guid>
      <dc:creator>nkavouris</dc:creator>
      <dc:date>2025-02-25T16:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proper Rex expression help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712499#M240346</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/262853"&gt;@nkavouris&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "hw_state:\sElements\(temp:\s(?&amp;lt;temp&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/FhThZf/1" target="_blank"&gt;https://regex101.com/r/FhThZf/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:30:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712499#M240346</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-02-25T16:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proper Rex expression help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712500#M240347</link>
      <description>&lt;P&gt;Grazie giuseppe, but this does not work in splunk unfortunately&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712500#M240347</guid>
      <dc:creator>nkavouris</dc:creator>
      <dc:date>2025-02-25T16:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proper Rex expression help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712501#M240348</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/262853"&gt;@nkavouris&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;what's the behavior of this regex: it extract too data or nothing?&lt;/P&gt;&lt;P&gt;it seems to be correct using the sample you shared.&lt;/P&gt;&lt;P&gt;Anyway, this seems to be a log in json format, did you tried to use INDEXED_EXTRACTIONS=JSON or spath?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:44:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712501#M240348</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-02-25T16:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proper Rex expression help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712503#M240350</link>
      <description>&lt;P&gt;No data extracted at all, and the data is JSON formatted.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I normally start my rex expressions with field=message "(rex expression)"&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:57:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712503#M240350</guid>
      <dc:creator>nkavouris</dc:creator>
      <dc:date>2025-02-25T16:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proper Rex expression help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712538#M240356</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/262853"&gt;@nkavouris&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it just "500" you are expecting to extract?&lt;/P&gt;&lt;P&gt;Your second regex looks pretty close but you are missing the \s for the space after : and before 500 - and a couple of other tweaks. Does this work for you?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=message "Elements\(temp:\s(?&amp;lt;set_temp&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;Please let me know how you get on and consider accepting this answer or adding karma this answer if it has helped.&lt;BR /&gt;Regards&lt;/P&gt;&lt;P&gt;Will&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 21:48:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712538#M240356</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-02-25T21:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proper Rex expression help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712558#M240362</link>
      <description>&lt;P&gt;This is a JSON object (except you should add quotes to those bare XXXX). &amp;nbsp;Do not use regex on structured data. &amp;nbsp;See the other thread you started. &amp;nbsp;Your search is inefficient because you use wildcard at the beginning of a term. &amp;nbsp;And there's a solution to that.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2025 04:16:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Proper-Rex-expression-help/m-p/712558#M240362</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-02-26T04:16:11Z</dc:date>
    </item>
  </channel>
</rss>

