<?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 How do I edit my transforms.conf to properly extract these fields from my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-transforms-conf-to-properly-extract-these/m-p/284358#M85977</link>
    <description>&lt;P&gt;Hi All.&lt;/P&gt;

&lt;P&gt;I want to extract fields from the following log data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;headerName=Host, Connection, Accept, headerValue=splunk.com, keep-alive, text/html
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to extract fields like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Host=splunk.com
Connection=keep-alive
Accept=text/html
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I set following in props and transforms&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[MY_SYSLOG]
REPORT-a = SAMPLE_1,SAMPLE_2,SAMPLE_3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[SAMPLE_1]
CLEAN_KEYS = 0
FORMAT = $1::$4
REGEX = headerName=(\w+),\s(\w+),\s(\w+),\sheaderValue=(.*?),\s(.*?),\s(.*)

[SAMPLE_2]
CLEAN_KEYS = 0
FORMAT = $2::$5
REGEX = headerName=(\w+),\s(\w+),\s(\w+),\sheaderValue=(.*?),\s(.*?),\s(.*)

[SAMPLE_3]
CLEAN_KEYS = 0
FORMAT = $3::$6
REGEX = headerName=(\w+),\s(\w+),\s(\w+),\sheaderValue=(.*?),\s(.*?),\s(.*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This setting extracted fields for part log message, but didn't extract fields for the following log message.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;headerName=Host, Connection, Accept, Referer, headerValue=splunk.com, keep-alive, text/html, &lt;A href="http://google.com" target="test_blank"&gt;http://google.com&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there good solution?&lt;/P&gt;

&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2016 04:59:56 GMT</pubDate>
    <dc:creator>akanno</dc:creator>
    <dc:date>2016-02-18T04:59:56Z</dc:date>
    <item>
      <title>How do I edit my transforms.conf to properly extract these fields from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-transforms-conf-to-properly-extract-these/m-p/284358#M85977</link>
      <description>&lt;P&gt;Hi All.&lt;/P&gt;

&lt;P&gt;I want to extract fields from the following log data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;headerName=Host, Connection, Accept, headerValue=splunk.com, keep-alive, text/html
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to extract fields like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Host=splunk.com
Connection=keep-alive
Accept=text/html
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I set following in props and transforms&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[MY_SYSLOG]
REPORT-a = SAMPLE_1,SAMPLE_2,SAMPLE_3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[SAMPLE_1]
CLEAN_KEYS = 0
FORMAT = $1::$4
REGEX = headerName=(\w+),\s(\w+),\s(\w+),\sheaderValue=(.*?),\s(.*?),\s(.*)

[SAMPLE_2]
CLEAN_KEYS = 0
FORMAT = $2::$5
REGEX = headerName=(\w+),\s(\w+),\s(\w+),\sheaderValue=(.*?),\s(.*?),\s(.*)

[SAMPLE_3]
CLEAN_KEYS = 0
FORMAT = $3::$6
REGEX = headerName=(\w+),\s(\w+),\s(\w+),\sheaderValue=(.*?),\s(.*?),\s(.*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This setting extracted fields for part log message, but didn't extract fields for the following log message.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;headerName=Host, Connection, Accept, Referer, headerValue=splunk.com, keep-alive, text/html, &lt;A href="http://google.com" target="test_blank"&gt;http://google.com&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there good solution?&lt;/P&gt;

&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2016 04:59:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-transforms-conf-to-properly-extract-these/m-p/284358#M85977</guid>
      <dc:creator>akanno</dc:creator>
      <dc:date>2016-02-18T04:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my transforms.conf to properly extract these fields from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-transforms-conf-to-properly-extract-these/m-p/284359#M85978</link>
      <description>&lt;P&gt;In the example that didn't work, do you want to extract Referer too?  Or do you only care about host, connection and accept?  Are the values always in the same order after the headerValue= part of the event?  Not sure if just hardcoding fieldname is an option or makes sense.&lt;/P&gt;

&lt;P&gt;In general though, there are probably a few ways to make this work for you.  It's just a regex thing.  For example, something like this might work in props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[MY_SYSLOG]
EXTRACT-myfields = headerName=Host,\s+?Connection,\s+?Accept,.+headerValue=(?&amp;lt;host&amp;gt;[^,]+),\s+?(?&amp;lt;connection&amp;gt;[^,]+),\s+?(?&amp;lt;Accept&amp;gt;[^,]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 06 Mar 2016 17:30:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-transforms-conf-to-properly-extract-these/m-p/284359#M85978</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2016-03-06T17:30:21Z</dc:date>
    </item>
  </channel>
</rss>

