<?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: How do I use regex to extract URL parameter field names in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286286#M86676</link>
    <description>&lt;P&gt;That works! How could I make so that the user could search url_parameters without typing the rex command? Can this be added to props.conf or transforms.conf?&lt;/P&gt;

&lt;P&gt;In the meantime you have given me a great head start!&lt;/P&gt;</description>
    <pubDate>Thu, 07 Apr 2016 20:36:12 GMT</pubDate>
    <dc:creator>DPWSplunkPOC</dc:creator>
    <dc:date>2016-04-07T20:36:12Z</dc:date>
    <item>
      <title>How do I use regex to extract URL parameter field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286283#M86673</link>
      <description>&lt;P&gt;I want to extract the field names from a URL's parameters. For example my raw event might look like this:&lt;/P&gt;

&lt;P&gt;action=accept host=myserver timestamp=01/01/2016:12:00:00 src_ip=1.1.1.1 domain=mydomain process=GET url=mywebpage.com/requestedpage.resquest?&lt;STRONG&gt;field1&lt;/STRONG&gt;=value1&amp;amp;&lt;STRONG&gt;field2&lt;/STRONG&gt;=value2&amp;amp;&lt;STRONG&gt;field3&lt;/STRONG&gt;=value3&lt;/P&gt;

&lt;P&gt;I would like the regex to capture all field names from the parameters into one capture group called url_parameter. &lt;/P&gt;

&lt;P&gt;I have the following regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^[^\?\n]\*\?(?P&amp;lt;\url_parameter\&amp;gt;\w+)*(?:[^&amp;amp;\n]\*&amp;amp;(\w+)) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*Note I added slashes around url_parameter because it looked like an HTML tag.&lt;/P&gt;

&lt;P&gt;It captures the first field after the question mark and places it in url_parameter capture group. It captures the the second field in a different capture group. Finally it does not capture field 3 or any number of remaining fields in the parameter. I'm far from a regex expert but I'm trying to teach myself. Any help is appreciated. Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 20:19:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286283#M86673</guid>
      <dc:creator>DPWSplunkPOC</dc:creator>
      <dc:date>2016-04-07T20:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use regex to extract URL parameter field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286284#M86674</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex  "^[^\?\n]*\?(?P&amp;lt;url_parameter&amp;gt;\S+)"  | rex max_match=0 field=url_parameter "(?&amp;lt;url_parameter&amp;gt;\w+)="
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2016 20:24:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286284#M86674</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-07T20:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use regex to extract URL parameter field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286285#M86675</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search here
| rex max_match=0 "(?msi)(?&amp;lt;url_parameter&amp;gt;field\d)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It'll create a multvalue field with all your field names that you can later on used the way you like.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 20:30:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286285#M86675</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-04-07T20:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use regex to extract URL parameter field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286286#M86676</link>
      <description>&lt;P&gt;That works! How could I make so that the user could search url_parameters without typing the rex command? Can this be added to props.conf or transforms.conf?&lt;/P&gt;

&lt;P&gt;In the meantime you have given me a great head start!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 20:36:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286286#M86676</guid>
      <dc:creator>DPWSplunkPOC</dc:creator>
      <dc:date>2016-04-07T20:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use regex to extract URL parameter field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286287#M86677</link>
      <description>&lt;P&gt;See this Splunk documentation page&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.3/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles#Handling_events_with_multivalue_fields"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.3/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles#Handling_events_with_multivalue_fields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
REPORT-urlparams = geturlparams
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[geturlparams]
REGEX = (?&amp;lt;url_parameter&amp;gt;\w+)=
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2016 20:45:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-regex-to-extract-URL-parameter-field-names/m-p/286287#M86677</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-07T20:45:57Z</dc:date>
    </item>
  </channel>
</rss>

