<?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 Regex in search key in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-in-search-key/m-p/101919#M26329</link>
    <description>&lt;P&gt;I have a log with entries like this: region.0="us" region.1="us_west" region.2="us_west_pacific" region.3="us_ca". The order and number of the values associated with the region keys is arbitrary. I'm new to splunk. I want to query for all logs where "us_west" is assigned to any of the region keys, basically something like: region.[0-9]="us_west". Is this possible?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 10:03:05 GMT</pubDate>
    <dc:creator>cloudharmony</dc:creator>
    <dc:date>2020-09-28T10:03:05Z</dc:date>
    <item>
      <title>Regex in search key</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-in-search-key/m-p/101919#M26329</link>
      <description>&lt;P&gt;I have a log with entries like this: region.0="us" region.1="us_west" region.2="us_west_pacific" region.3="us_ca". The order and number of the values associated with the region keys is arbitrary. I'm new to splunk. I want to query for all logs where "us_west" is assigned to any of the region keys, basically something like: region.[0-9]="us_west". Is this possible?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:03:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-in-search-key/m-p/101919#M26329</guid>
      <dc:creator>cloudharmony</dc:creator>
      <dc:date>2020-09-28T10:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regex in search key</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-in-search-key/m-p/101920#M26330</link>
      <description>&lt;P&gt;Well, given your sample data, you can list them with a search like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=_raw " (?&amp;lt;region_key&amp;gt;[^=]+)=us_west " | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Plese note that the initial dots indicate your base search with source/sourcetype etc, and the trailing dots indicate the stats/chart/table/whatever operations you may want to use on your newly discovered regions.&lt;/P&gt;

&lt;P&gt;If your log messages contain double quotes (") around the values, you would probably need to escape them with a backslash in the rex statement... I guess. I haven't tried that one.&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2011 22:04:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-in-search-key/m-p/101920#M26330</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2011-11-01T22:04:23Z</dc:date>
    </item>
  </channel>
</rss>

