<?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: adding a new log format: detect all the fields in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/adding-a-new-log-format-detect-all-the-fields/m-p/89145#M18504</link>
    <description>&lt;P&gt;Following up on what Genti said.  You really don't want do indexed fields, you want search-time field extractions.  So move your "proxy" from a &lt;CODE&gt;TRANSFORMS&lt;/CODE&gt; to a &lt;CODE&gt;REPORT&lt;/CODE&gt; entry.  Also, I'd be extra careful extracting a field called "_time", since this is a built in and very important field used internally by splunk.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Feb 2011 01:38:02 GMT</pubDate>
    <dc:creator>Lowell</dc:creator>
    <dc:date>2011-02-19T01:38:02Z</dc:date>
    <item>
      <title>adding a new log format: detect all the fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/adding-a-new-log-format-detect-all-the-fields/m-p/89143#M18502</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to add a new custom log format, so splunk can recognize all the fields in this log:&lt;/P&gt;

&lt;PRE&gt;
    #proxy_code c_ip "user" "profile" timestamp "url" http_status "user_agent" _time
    - 10.20.11.24 "user1" "profile1" [1/Nov/2010:11:44:51 +0100] "GET &lt;A href="http://example.com/" target="test_blank"&gt;http://example.com/&lt;/A&gt; HTTP/1.1" 200 "Mozilla/4.0" 1289818694
    4 10.20.13.19 "user3" "profile2" [1/Nov/2010:11:44:54 +0100] "GET &lt;A href="http://server1.com/" target="test_blank"&gt;http://server1.com/&lt;/A&gt; HTTP/1.1" 200 "Mozilla/4.0" 1289818697
    - 10.20.12.16 "-" "-" [1/Nov/2010:11:44:54 +0100] "GET &lt;A href="http://www.example2.com/" target="test_blank"&gt;http://www.example2.com/&lt;/A&gt; HTTP/1.1" 200 "Mozilla/4.0" 1289818697
    80 19.55.54.22 "user10" "profile5" [1/Nov/2010:11:44:54 +0100] "GET &lt;A href="http://abc.server.com/" target="test_blank"&gt;http://abc.server.com/&lt;/A&gt; HTTP/1.1" 200 "MSIE" 1289818697
&lt;/PRE&gt;

&lt;P&gt;to execute following queries:
source=proxy profile=profile2 proxy_code=4
etc.&lt;/P&gt;

&lt;P&gt;my steps:&lt;/P&gt;

&lt;P&gt;-1. create new etc\apps\search\local\transforms.conf with a new sourcetype:&lt;/P&gt;

&lt;PRE&gt;
    [proxy]
    REGEX = ^([0-9\-]*) ([0-9\.]+) "([^"]+)" "([^"]+)" (\[[^\]+\]) ("[^"]+") ([0-9\-]+) ("[^"]+") ([0-9]*)
    FORMAT = proxy_code::$1 c_ip::$2 user::$3 profile::$4 timestamp::$5 url::$6 http_status::$7 user_agent::$9 _time::$14
&lt;/PRE&gt;

&lt;P&gt;-2. create etc\apps\search\local\inputs.conf:&lt;/P&gt;

&lt;PRE&gt;
    [nullPound]
    REGEX = ^\#
    DEST_KEY = queue
    FORMAT = nullQueue

    [monitor://c:\proxylogs]
    disabled = false
    followTail = 0
    host = proxy
    sourcetype = proxy
&lt;/PRE&gt;

&lt;P&gt;-3. create etc\apps\search\local\props.conf&lt;/P&gt;

&lt;PRE&gt;
    [proxy]
    TRANSFORMS-logformat = proxy
&lt;/PRE&gt;

&lt;P&gt;-4. restart splunk&lt;/P&gt;

&lt;P&gt;I can find the events with sourcetype="proxy", but the fields are not recognized, 
for example c_ip="10.20.11.24" doesnt work.&lt;/P&gt;

&lt;P&gt;The comments are not removed despite of nullPound-rule in transforms.conf&lt;/P&gt;

&lt;P&gt;do I missing something?&lt;/P&gt;

&lt;P&gt;BR&lt;/P&gt;

&lt;P&gt;PS: &lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2010 02:44:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/adding-a-new-log-format-detect-all-the-fields/m-p/89143#M18502</guid>
      <dc:creator>kerne1</dc:creator>
      <dc:date>2010-11-16T02:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: adding a new log format: detect all the fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/adding-a-new-log-format-detect-all-the-fields/m-p/89144#M18503</link>
      <description>&lt;P&gt;First, you say:&lt;BR /&gt;
2. create etc\apps\search\local\inputs.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[nullPound]
REGEX = ^#
DEST_KEY = queue
FORMAT = nullQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Either this is a typo when you asked the question, or you are putting this line in the wrong config file. (this should be in transforms.conf)&lt;/P&gt;

&lt;P&gt;Then, It seems like you are never actually calling the [nullPound] transform, ie, something like this should work: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[proxy]
TRANSFORMS-logformat = proxy, nullPound
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and Third, do you need these field extractions to be index time field extraction? Have you thought of using Search time field extractions instead? (it would make your indexing faster..)
&lt;A href="http://www.splunk.com/base/Documentation/4.1.5/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.5/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;More specifically, this should be helpful:
  Extract multiple fields using one regex&lt;/P&gt;

&lt;P&gt;This is an example of a field extraction that pulls out five separate fields. You can then use these fields in concert with some event types to help you find port flapping events and report on them.&lt;/P&gt;

&lt;P&gt;Here's a sample of the event data that the fields are being extracted from:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet9/16, changed state to down

The stanza in props.conf for the extraction looks like this:

    [syslog]
    EXTRACT-&amp;lt;port_flapping&amp;gt; = Interface\s(?&amp;lt;interface&amp;gt;(?&amp;lt;media&amp;gt;[^\d]+)(?&amp;lt;slot&amp;gt;\d+)\/(?&amp;lt;port&amp;gt;\d+))\,\schanged
    \sstate\sto\s(?&amp;lt;port_status&amp;gt;up|down)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Nov 2010 03:12:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/adding-a-new-log-format-detect-all-the-fields/m-p/89144#M18503</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2010-11-16T03:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: adding a new log format: detect all the fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/adding-a-new-log-format-detect-all-the-fields/m-p/89145#M18504</link>
      <description>&lt;P&gt;Following up on what Genti said.  You really don't want do indexed fields, you want search-time field extractions.  So move your "proxy" from a &lt;CODE&gt;TRANSFORMS&lt;/CODE&gt; to a &lt;CODE&gt;REPORT&lt;/CODE&gt; entry.  Also, I'd be extra careful extracting a field called "_time", since this is a built in and very important field used internally by splunk.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2011 01:38:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/adding-a-new-log-format-detect-all-the-fields/m-p/89145#M18504</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2011-02-19T01:38:02Z</dc:date>
    </item>
  </channel>
</rss>

