<?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: Multiple fields extractions in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54868#M10652</link>
    <description>&lt;P&gt;You can use an inline rex:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search | rex field=_raw "client\s*(?&amp;lt;clientip&amp;gt;[^#]*)\d+:\s*query:\s*(?&amp;lt;query&amp;gt;[^\s]*)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You can use a props extract in props.conf&lt;BR /&gt;
&lt;CODE&gt;[sourcetype]&lt;BR /&gt;
EXTRACT-thosefields = client\s*(?&amp;lt;clientip&amp;gt;[^#]*)\d+:\s*query:\s*(?&amp;lt;query&amp;gt;[^\s]*)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You can do it using props/transforms.&lt;/P&gt;

&lt;P&gt;in props.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[sourcetype]&lt;BR /&gt;
REPORT-thosefields = thosefields_for_sourcetype&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;in transforms.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[thosefields_for_sourcetype]&lt;BR /&gt;
REGEX = client\s*([^#]*)\d+:\s*query:\s*([^\s]*)&lt;BR /&gt;
FORMAT = clientip::$1 query::$2&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2013 18:41:42 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2013-03-07T18:41:42Z</dc:date>
    <item>
      <title>Multiple fields extractions</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54867#M10651</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have this log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;07-Mar-2013 18:44:17.540 client 172.16.30.10#47729: query: &lt;A href="https://community.splunk.com/www.atlas.cz" target="test_blank"&gt;www.atlas.cz&lt;/A&gt; IN A + (172.16.30.10)
07-Mar-2013 18:44:17.540 client 172.16.30.7#49729: query: &lt;A href="https://community.splunk.com/www.seznam.cz" target="test_blank"&gt;www.seznam.cz&lt;/A&gt; IN A + (172.16.30.10)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and I need to extract two fields, client and query:&lt;BR /&gt;
I have regex for client and query extraction but I dont know how to extract it once.&lt;/P&gt;

&lt;P&gt;For query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i) query: (?P&amp;lt;query&amp;gt;[^ ]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For client:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i) client (?P&amp;lt;client&amp;gt;[^#]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for help&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2013 18:15:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54867#M10651</guid>
      <dc:creator>rexcze</dc:creator>
      <dc:date>2013-03-07T18:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple fields extractions</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54868#M10652</link>
      <description>&lt;P&gt;You can use an inline rex:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search | rex field=_raw "client\s*(?&amp;lt;clientip&amp;gt;[^#]*)\d+:\s*query:\s*(?&amp;lt;query&amp;gt;[^\s]*)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You can use a props extract in props.conf&lt;BR /&gt;
&lt;CODE&gt;[sourcetype]&lt;BR /&gt;
EXTRACT-thosefields = client\s*(?&amp;lt;clientip&amp;gt;[^#]*)\d+:\s*query:\s*(?&amp;lt;query&amp;gt;[^\s]*)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You can do it using props/transforms.&lt;/P&gt;

&lt;P&gt;in props.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[sourcetype]&lt;BR /&gt;
REPORT-thosefields = thosefields_for_sourcetype&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;in transforms.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[thosefields_for_sourcetype]&lt;BR /&gt;
REGEX = client\s*([^#]*)\d+:\s*query:\s*([^\s]*)&lt;BR /&gt;
FORMAT = clientip::$1 query::$2&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2013 18:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54868#M10652</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-03-07T18:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple fields extractions</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54869#M10653</link>
      <description>&lt;P&gt;It doesn work. If I try this:&lt;/P&gt;

&lt;P&gt;source="/var/log/named/bind.log" | rex field=_raw "client\s*(?&lt;CLIENTIP&gt;[^#]&lt;EM&gt;)\d+:\s*query:\s&lt;/EM&gt;(?&lt;QUERY&gt;[^\s]*)"|table query clientip&lt;/QUERY&gt;&lt;/CLIENTIP&gt;&lt;/P&gt;

&lt;P&gt;it shows empty table&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:29:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54869#M10653</guid>
      <dc:creator>rexcze</dc:creator>
      <dc:date>2020-09-28T13:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple fields extractions</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54870#M10654</link>
      <description>&lt;P&gt;Apparently, the &lt;CODE&gt;#&lt;/CODE&gt; is special to python regex. Try this: &lt;CODE&gt;client\s*(\d+\.\d+\.\d+\.\d+)\#\d*:\s*query:\s*([^\s]*)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2013 16:32:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multiple-fields-extractions/m-p/54870#M10654</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-03-11T16:32:25Z</dc:date>
    </item>
  </channel>
</rss>

