<?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: Field Extraction using Regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649201#M224504</link>
    <description>&lt;P&gt;Very interesting. As you can see here&amp;nbsp;&lt;A href="https://regex101.com/r/0gc9lk/1" target="_blank"&gt;https://regex101.com/r/0gc9lk/1&lt;/A&gt;&amp;nbsp;those are extracted correctly. Are you sure that you don't add that \ to this string? On your examples there are no \ character at the end of n_id!&lt;/P&gt;&lt;P&gt;Can you show your SPL?&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jul 2023 17:59:55 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2023-07-04T17:59:55Z</dc:date>
    <item>
      <title>Help with Field Extraction using Regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649179#M224496</link>
      <description>&lt;P&gt;I am trying to extract 2 fields from my logs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Logs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;10.218.136.20 - - [30/Jun/2023:02:36:32 +0000] "GET /api/v2/runs/run-g1mhsXooK6aKV9bS?include=plan%2Ccost_estimate%2Capply%2Ccreated_by HTTP/1.1" 200 5460 "https://terraform.srv.companyname.com.au/app/customer/workspaces/a00ccc-tfe-test02-customer_infra_ping/runs/run-g1mhsXooK6aKV9bS" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here i want to extract 2 new fields&lt;/P&gt;
&lt;P&gt;&amp;nbsp;1.&amp;nbsp;&lt;STRONG&gt;workspace_name=&lt;/STRONG&gt;"a00ccc-tfe-test02-customer_infra_ping"&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;&lt;STRONG&gt;workspace_id="&lt;/STRONG&gt;g1mhsXooK6aKV9bS&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Please help me with regex &amp;amp; thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 16:34:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649179#M224496</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-07-07T16:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649181#M224497</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you could try&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rex "workspaces\/(?&amp;lt;workspace_name&amp;gt;[^\/]+)\/runs\/run-(?&amp;lt;workspace_id&amp;gt;[^\"]+)"&lt;/LI-CODE&gt;&lt;P&gt;see&amp;nbsp;&lt;A href="https://regex101.com/r/aywynb/1" target="_blank"&gt;https://regex101.com/r/aywynb/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 17:01:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649181#M224497</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-07-04T17:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649184#M224498</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;Thanks for your reply.&lt;/P&gt;&lt;P&gt;Results for &lt;STRONG&gt;Workspace_name&lt;/STRONG&gt; is fine. But &lt;STRONG&gt;workspace_id&lt;/STRONG&gt; ends with a backslash. Can i get the result without \&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alexspunkshell_0-1688490556809.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26121iBF9A39714C708B21/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alexspunkshell_0-1688490556809.png" alt="alexspunkshell_0-1688490556809.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 17:11:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649184#M224498</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-07-04T17:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649188#M224499</link>
      <description>&lt;P&gt;Your examples didn' t contains / on workspace_id! You could try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rex "workspaces\/(?&amp;lt;workspace_name&amp;gt;[^\/]+)\/runs\/run-(?&amp;lt;workspace_id&amp;gt;[^\"\\]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 17:37:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649188#M224499</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-07-04T17:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649192#M224501</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;Still i am getting "\" at the end of the workspace_id results.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 17:35:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649192#M224501</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-07-04T17:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649194#M224502</link>
      <description>&lt;P&gt;Then your logs are not as your examples was on this thread. Can you give some more events as an example? Especially those with has the \ at the end on w_id!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 17:38:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649194#M224502</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-07-04T17:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649199#M224503</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other logs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;10.218.136.20 - - [30/Jun/2023:02:36:37 +0000] "GET /api/v2/workspaces/ws-ukz9TnHNE9kN4eCa?include=agent_pool%2Ccurrent_configuration_version%2Ccurrent_run%2Ccurrent_state_version%2Clocked_by%2Creadme%2Coutputs HTTP/1.1" 304 0 "https://terraform.srv.companyname.com.au/app/customer/workspaces/a00ccc-tfe-dev02-customer_infra/runs/run-ACevPzmMTYE6UP5e" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"


10.218.136.20 - - [30/Jun/2023:02:36:40 +0000] "GET /api/v2/runs/run-Y63d5qeBk3pDHpJZ/run-events?include=comment%2Cactor HTTP/1.1" 304 0 "https://terraform.srv.companyname.com.au/app/customer/workspaces/a00964-tfe-test-customer_infra_main/runs/run-Y63d5qeBk3pDHpJZ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 17:50:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649199#M224503</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-07-04T17:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649201#M224504</link>
      <description>&lt;P&gt;Very interesting. As you can see here&amp;nbsp;&lt;A href="https://regex101.com/r/0gc9lk/1" target="_blank"&gt;https://regex101.com/r/0gc9lk/1&lt;/A&gt;&amp;nbsp;those are extracted correctly. Are you sure that you don't add that \ to this string? On your examples there are no \ character at the end of n_id!&lt;/P&gt;&lt;P&gt;Can you show your SPL?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 17:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649201#M224504</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-07-04T17:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649204#M224505</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alexspunkshell_0-1688493970752.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26125i45ECCDF2E2B0366A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alexspunkshell_0-1688493970752.png" alt="alexspunkshell_0-1688493970752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alexspunkshell_1-1688493832345.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26124iC94B4EC09C8BD7D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alexspunkshell_1-1688493832345.png" alt="alexspunkshell_1-1688493832345.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 18:06:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649204#M224505</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-07-04T18:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649210#M224506</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First line of the below log Y63......ends with /. Whereas third line y63....ends usually. Does this make change?&lt;/P&gt;&lt;PRE&gt;10.218.136.20 - - [30/Jun/2023:02:36:40 +0000] "GET /api/v2/runs/run-Y63d5qeBk3pDHpJZ/run-events?include=comment%2Cactor HTTP/1.1" 304 0 "https://terraform.srv.companyname.com.au/app/customer/workspaces/a00964-tfe-test-customer_infra_main/runs/run-Y63d5qeBk3pDHpJZ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 18:18:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649210#M224506</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-07-04T18:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649218#M224507</link>
      <description>&lt;P&gt;This rex shouldn't match this first occurrence of runs/run-xxx as it expecting that there must be workspaces/xxxx before it. So it is matching the second&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;runs/run-Y63d5qeBk3pDHpJZ"&lt;/PRE&gt;&lt;P&gt;which didn't contains / character. BTW there was mistake \/ instead of \\ on &amp;nbsp;rex. I have fixed it already, so you should also fix it in your extractions.&lt;/P&gt;&lt;P&gt;Can you test this without extractions just with SPL?&lt;/P&gt;&lt;P&gt;Something like&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test sourcetype="testdata"
| rex "workspaces\/(?&amp;lt;workspace_name&amp;gt;[^\/]+)\/runs\/run-(?&amp;lt;workspace_id&amp;gt;[^\"\\]+)" 
| table _time workspace_name workspace_id&lt;/LI-CODE&gt;&lt;P&gt;just check that this works also on your real data. If need you could change the workspace_id to AAAAAA on rex to be sure that it's not defined somewhere else.&lt;/P&gt;&lt;P&gt;Are you sure that you haven't earlier definition for workspace_id somewhere? If you could login to command line you could try&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;splunk btool props list --debug testdata&lt;/LI-CODE&gt;&lt;P&gt;This should show all props definition to that sourcetype and where those are defined.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 18:43:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Field-Extraction-using-Regex/m-p/649218#M224507</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-07-04T18:43:46Z</dc:date>
    </item>
  </channel>
</rss>

