<?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: Help with Regex extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626530#M217761</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245378"&gt;@siksaw33&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this seems to be a json file, so at first try to use the spath command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.3/SearchReference/Spath" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.3/SearchReference/Spath&lt;/A&gt;) that automatically extracts all the fields.&lt;/P&gt;&lt;P&gt;Otherwise, you can use this regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "^(?&amp;lt;time&amp;gt;[^ ]+).*clientIdentifier\\\":(?&amp;lt;clientIdentifier&amp;gt;[^,]+).*userId\\\":(?&amp;lt;userId&amp;gt;[^,]+)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/Mb2Z3z/1" target="_blank"&gt;https://regex101.com/r/Mb2Z3z/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 08:08:17 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-01-10T08:08:17Z</dc:date>
    <item>
      <title>Help with Regex extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626453#M217735</link>
      <description>&lt;LI-CODE lang="markup"&gt;2023-01-09T16:46:00.780076351Z app_name=default-java environment=e3 ns=one pod_container=default-java pod_name=default stream=stdout message={"name":"com","timestamp":"2023-01-09T16:46:00.779Z","level":"info","schemaVersion":"0.1","application":{"name":"com ","version":"1.2.5"},"request":{"address":{"uri":"Read/1.2.5"},"metadata":{"one-data-correlation-id":"d5d3 ","one-data-trace-id":"0be"}},"message":"Parent Function Address: Read, Request identifier: d5d35c6e-3661-4445-bbe4-f5a3f382d035, REQUEST-RECEIVED: {\"requestIdentifier\""d5 \",\"clientIdentifier\""CUST \",\"locale\""en-US\",\"userId\""lkapla\",\"accountNumber\""1234\",\"treatmentsFilter\":[\"targeted\",\"messages\"],\"callerType\""ADDTL\",\"cancelType\""\",\"handle\""gsp00a79e6b_b610_3407_90fa_11d5417c0b7f\",\"callTimeStamp\""1/9/2023 9:46:00 AM\",\"callIdentifier\""01091\",\"geoTelIdentifier\""04ba\"}, "}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract the time, userid and&amp;nbsp; &lt;SPAN&gt;clientIdentifier in a table?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:05:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626453#M217735</guid>
      <dc:creator>siksaw33</dc:creator>
      <dc:date>2023-01-10T16:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626463#M217740</link>
      <description>&lt;P&gt;FYI I used rex field=_raw "userId\\\\\":\\\\\"(?&amp;lt;userId&amp;gt;[a-z]+)"&amp;nbsp; for this&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 18:48:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626463#M217740</guid>
      <dc:creator>siksaw33</dc:creator>
      <dc:date>2023-01-09T18:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626530#M217761</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245378"&gt;@siksaw33&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this seems to be a json file, so at first try to use the spath command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.3/SearchReference/Spath" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.3/SearchReference/Spath&lt;/A&gt;) that automatically extracts all the fields.&lt;/P&gt;&lt;P&gt;Otherwise, you can use this regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "^(?&amp;lt;time&amp;gt;[^ ]+).*clientIdentifier\\\":(?&amp;lt;clientIdentifier&amp;gt;[^,]+).*userId\\\":(?&amp;lt;userId&amp;gt;[^,]+)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/Mb2Z3z/1" target="_blank"&gt;https://regex101.com/r/Mb2Z3z/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 08:08:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626530#M217761</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-10T08:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626547#M217767</link>
      <description>&lt;P&gt;Similar to your other question, please post JSON objects in code blocks because some combinations turn into smileys. &amp;nbsp;As I said there, try not to treat JSON objects like text strings. &amp;nbsp;Use SPL's built-in capabilities to deal with structured data.&lt;/P&gt;&lt;P&gt;With your raw logs, Splunk should have extracted the field "message". &amp;nbsp;Inside message, there's a JSON node named "message". &amp;nbsp;Somehow spath cannot work well with duplicate names. &amp;nbsp;So, we'll rename the Splunk field "message" first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename message AS data
| spath input=data
| eval REQUEST_RECEIVED = replace(message, ".*, REQUEST-RECEIVED: ", "")
| spath input=REQUEST_RECEIVED
| fields - REQUEST_RECEIVED data message&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your sample data - after correction for smileys, would give this output that contains multiple time fields as well as other data about the request.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="128.484375px" height="47px"&gt;accountNumber&lt;/TD&gt;&lt;TD width="88px" height="47px"&gt;app_name&lt;/TD&gt;&lt;TD width="134.890625px" height="47px"&gt;application.name&lt;/TD&gt;&lt;TD width="146.234375px" height="47px"&gt;application.version&lt;/TD&gt;&lt;TD width="101.078125px" height="47px"&gt;callIdentifier&lt;/TD&gt;&lt;TD width="109.296875px" height="47px"&gt;callTimetamp&lt;/TD&gt;&lt;TD width="86.015625px" height="47px"&gt;callerType&lt;/TD&gt;&lt;TD width="94.09375px" height="47px"&gt;cancelType&lt;/TD&gt;&lt;TD width="116.40625px" height="47px"&gt;clientIdentifier&lt;/TD&gt;&lt;TD width="102.390625px" height="47px"&gt;environment&lt;/TD&gt;&lt;TD width="123.421875px" height="47px"&gt;geoTelIdentifier&lt;/TD&gt;&lt;TD width="367.765625px" height="47px"&gt;handle&lt;/TD&gt;&lt;TD width="44.0625px" height="47px"&gt;level&lt;/TD&gt;&lt;TD width="54.046875px" height="47px"&gt;locale&lt;/TD&gt;&lt;TD width="51.375px" height="47px"&gt;name&lt;/TD&gt;&lt;TD width="40px" height="47px"&gt;ns&lt;/TD&gt;&lt;TD width="117.4375px" height="47px"&gt;pod_container&lt;/TD&gt;&lt;TD width="88.609375px" height="47px"&gt;pod_name&lt;/TD&gt;&lt;TD width="149.390625px" height="47px"&gt;request.address.uri&lt;/TD&gt;&lt;TD width="175.609375px" height="47px"&gt;request.metadata.one-data-correlation-id&lt;/TD&gt;&lt;TD width="175.609375px" height="47px"&gt;request.metadata.one-data-trace-id&lt;/TD&gt;&lt;TD width="131.828125px" height="47px"&gt;requestIdentifier&lt;/TD&gt;&lt;TD width="121.578125px" height="47px"&gt;schemaVersion&lt;/TD&gt;&lt;TD width="61.59375px" height="47px"&gt;stream&lt;/TD&gt;&lt;TD width="145.375px" height="47px"&gt;timestamp&lt;/TD&gt;&lt;TD width="140.09375px" height="47px"&gt;&lt;DIV class=""&gt;treatmentsFilter{}&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="56.125px" height="47px"&gt;userId&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="128.484375px" height="47px"&gt;1234&lt;/TD&gt;&lt;TD width="88px" height="47px"&gt;default-java&lt;/TD&gt;&lt;TD width="134.890625px" height="47px"&gt;com&lt;/TD&gt;&lt;TD width="146.234375px" height="47px"&gt;1.2.5&lt;/TD&gt;&lt;TD width="101.078125px" height="47px"&gt;01091&lt;/TD&gt;&lt;TD width="109.296875px" height="47px"&gt;1/9/2023 9:46:00 AM&lt;/TD&gt;&lt;TD width="86.015625px" height="47px"&gt;ADDTL&lt;/TD&gt;&lt;TD width="94.09375px" height="47px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="116.40625px" height="47px"&gt;CUST&lt;/TD&gt;&lt;TD width="102.390625px" height="47px"&gt;e3&lt;/TD&gt;&lt;TD width="123.421875px" height="47px"&gt;04ba&lt;/TD&gt;&lt;TD width="367.765625px" height="47px"&gt;gsp00a79e6b_b610_3407_90fa_11d5417c0b7f&lt;/TD&gt;&lt;TD width="44.0625px" height="47px"&gt;info&lt;/TD&gt;&lt;TD width="54.046875px" height="47px"&gt;en-US&lt;/TD&gt;&lt;TD width="51.375px" height="47px"&gt;com&lt;/TD&gt;&lt;TD width="40px" height="47px"&gt;one&lt;/TD&gt;&lt;TD width="117.4375px" height="47px"&gt;default-java&lt;/TD&gt;&lt;TD width="88.609375px" height="47px"&gt;default&lt;/TD&gt;&lt;TD width="149.390625px" height="47px"&gt;Read/1.2.5&lt;/TD&gt;&lt;TD width="175.609375px" height="47px"&gt;d5d3&lt;/TD&gt;&lt;TD width="175.609375px" height="47px"&gt;0be&lt;/TD&gt;&lt;TD width="131.828125px" height="47px"&gt;d5&lt;/TD&gt;&lt;TD width="121.578125px" height="47px"&gt;0.1&lt;/TD&gt;&lt;TD width="61.59375px" height="47px"&gt;stdout&lt;/TD&gt;&lt;TD width="145.375px" height="47px"&gt;2023-01-09T16:46:00.779Z&lt;/TD&gt;&lt;TD width="140.09375px" height="47px"&gt;&lt;DIV class=""&gt;targeted&lt;/DIV&gt;&lt;DIV class=""&gt;messages&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="56.125px" height="47px"&gt;lkapla&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 09:13:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626547#M217767</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-01-10T09:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626931#M217878</link>
      <description>&lt;P&gt;Thank you so much &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 14:25:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-extraction/m-p/626931#M217878</guid>
      <dc:creator>siksaw33</dc:creator>
      <dc:date>2023-01-12T14:25:56Z</dc:date>
    </item>
  </channel>
</rss>

