<?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: Log pre processing in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285988#M54598</link>
    <description>&lt;P&gt;Thanks.&lt;BR /&gt;
This seems what I need but I don't know why it isn't working on my environment.&lt;/P&gt;

&lt;P&gt;I've a Splunk Enterprise server where I crated an index called "anomalies".&lt;BR /&gt;
Also I have  a second node where I installed the Splunk universal forwarder&lt;/P&gt;

&lt;P&gt;The configuration of the Splunk universal forwarder is the following:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;File:&lt;/STRONG&gt; /opt/splunkforwarder/etc/apps/search/local/inputs.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///tmp/my.log]
disabled = false
index = anomalies
sourcetype = test-csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;File:&lt;/STRONG&gt;  /opt/splunkforwarder/etc/system/local/props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[test-csv]
DATETIME_CONFIG = CURRENT
REPORT-fields = sourcetype-test-csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;File:&lt;/STRONG&gt;  /opt/splunkforwarder/etc/system/local/transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype-test-csv]
REGEX = ([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),\[([^]]+)\],([^,]+),([^,]+),\[([^]]+)\]
FORMAT = COL1::$1 COL2::$2 COL3::$3 COL4::$4 COL5::$5 COL6::$6 COL7::$7 COL8::$8 COL9::$9 COL10::$10 COL11::$11 COL12::$12 COL13::$13 COL14::$14
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;File&lt;/STRONG&gt; /tmp/my.log&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1,2,1411261200000,4,5,6,7,8,9,10,[11],12,13,[ALARM]
1,2,1411261200000,4,5,6,7,8,9,10,[11],12,13,[ALARM]
1,2,1411261200000,4,5,GCD244,7,8,9,10,[11,12,13,[ALARM]
1,2,1411261200000,4,5,6,7,8,9,10,[11],12,13,[ALARM]
1,2,1411261200000,4,5,6,7,8,9,10,[11,111,1111],12,13,[ALARM]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Splunk Web search:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://dl.dropboxusercontent.com/u/3244719/Screen%20Shot%202017-02-14%20at%2010.02.05.png" alt="alt text" /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2017 09:03:00 GMT</pubDate>
    <dc:creator>faustf</dc:creator>
    <dc:date>2017-02-14T09:03:00Z</dc:date>
    <item>
      <title>Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285984#M54594</link>
      <description>&lt;P&gt;Hi guys,&lt;BR /&gt;
I defined my source type as follow (in props.conf):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[anomalies]
DATETIME_CONFIG =
FIELD_NAMES = COL1, COL2, TIMESTAMP, COL4, COL5, KPI_ID ,COL7, COL8, COL9, COL10, COL11, COL12, COL13, ALARM
INDEXED_EXTRACTIONS = csv
NO_BINARY_CHECK = true
SHOULD_LINEMERGE = false
category = AAAA
pulldown_type = 1
disabled = false
FIELD_DELIMITER = ,
TIME_PREFIX = .*?,.*?,
MAX_TIMESTAMP_LOOKAHEAD = 10
TZ = UTC
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and my log file is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1,2,1411261200000,4,5,6,7,8,9,10,[11],12,13,[ALARM]
1,2,1411261200000,4,5,6,7,8,9,10,[11],12,13,[ALARM]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My problem is that I need to replace all the &lt;STRONG&gt;[&lt;/STRONG&gt; and &lt;STRONG&gt;]&lt;/STRONG&gt; characters  with &lt;STRONG&gt;"[&lt;/STRONG&gt; or  &lt;STRONG&gt;]"&lt;/STRONG&gt;&lt;BR /&gt;
I need this pre-processing because in my log file I've also some lines in the following format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1,2,1411261200000,4,5,6,7,8,9,10,[11,111,1111],12,13,[ALARM]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field &lt;STRONG&gt;[11,111,1111]&lt;/STRONG&gt; is my problem because Splunk split this filed in 3 different fields:&lt;BR /&gt;
[11&lt;BR /&gt;
111&lt;BR /&gt;
1111]&lt;/P&gt;

&lt;P&gt;How can I solve this problem?&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 16:38:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285984#M54594</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-13T16:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285985#M54595</link>
      <description>&lt;P&gt;Add this to your props.conf on your ingestion side (forwarders or indexers)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourceTypeName]
SEDCMD-AAAremoveSquareBrackets = s/\[|\]//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is to say...   for every [ OR ] replace with nothing and do so globally (g is probably not required in this case)&lt;/P&gt;

&lt;P&gt;We put AAA in front of class name because SEDCMD's are processed with ASCII order of precedence and AAA is most likely the highest priority in you environment.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 16:50:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285985#M54595</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-02-13T16:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285986#M54596</link>
      <description>&lt;P&gt;Thank for your answer.&lt;/P&gt;

&lt;P&gt;I need to convert the list in square brackets in  a single element otherwise the number of the fields of the csv depends on the number of the elements in the square list. I modified the props.conf in this way&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[anomalies]
....
SEDCMD-squares-open = s/\[/"[/g
SEDCMD-squares-close = s/\]/]"/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, even in this way, the list is split into several elements&lt;BR /&gt;
&lt;IMG src="https://dl.dropboxusercontent.com/u/3244719/Screen%20Shot%202017-02-14%20at%2008.15.33.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;As you can see in the first line of the image the square brackets have been replaced with "[ and ]" but Splunk still split these elements (COL11,COL12,COL13)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 07:25:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285986#M54596</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-14T07:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285987#M54597</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;A different approach would be to do the extractions at Search time, using a combination of &lt;CODE&gt;props.conf&lt;/CODE&gt; and &lt;CODE&gt;transforms.conf&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I did a quick test with this in my &lt;CODE&gt;props.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[test-csv]
REPORT-fields = sourcetype-test-csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You'd want to remove all of the &lt;CODE&gt;FIELD_NAMES&lt;/CODE&gt;, &lt;CODE&gt;INDEXED_EXTRACTIONS&lt;/CODE&gt; and &lt;CODE&gt;FIELD_DELIMITER&lt;/CODE&gt; stuff.&lt;/P&gt;

&lt;P&gt;And this in my &lt;CODE&gt;transforms.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype-test-csv]
REGEX = ([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),\[([^]]+)\],([^,]+),([^,]+),\[([^]]+)\]
FORMAT = COL1::$1 COL2::$2 COL3::$3 COL4::$4 COL5::$5 COL6::$6 COL7::$7 COL8::$8 COL9::$9 COL10::$10 COL11::$11 COL12::$12 COL13::$13 COL14::$14
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This looks like it would give you what you're looking for?&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2454i1DEE1BB62BA5E497/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Just make sure that the REGEX you use in &lt;CODE&gt;transforms.conf&lt;/CODE&gt; is appropriate for the format of your data. It was a rough and ready example, so may need refining!&lt;/P&gt;

&lt;P&gt;Hope that helps to get you closer to what you need.&lt;BR /&gt;
(Oh and change the name of the 14th field to be ALARM if you want it to be the same as your example)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 08:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285987#M54597</guid>
      <dc:creator>gvmorley</dc:creator>
      <dc:date>2017-02-14T08:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285988#M54598</link>
      <description>&lt;P&gt;Thanks.&lt;BR /&gt;
This seems what I need but I don't know why it isn't working on my environment.&lt;/P&gt;

&lt;P&gt;I've a Splunk Enterprise server where I crated an index called "anomalies".&lt;BR /&gt;
Also I have  a second node where I installed the Splunk universal forwarder&lt;/P&gt;

&lt;P&gt;The configuration of the Splunk universal forwarder is the following:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;File:&lt;/STRONG&gt; /opt/splunkforwarder/etc/apps/search/local/inputs.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///tmp/my.log]
disabled = false
index = anomalies
sourcetype = test-csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;File:&lt;/STRONG&gt;  /opt/splunkforwarder/etc/system/local/props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[test-csv]
DATETIME_CONFIG = CURRENT
REPORT-fields = sourcetype-test-csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;File:&lt;/STRONG&gt;  /opt/splunkforwarder/etc/system/local/transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype-test-csv]
REGEX = ([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),\[([^]]+)\],([^,]+),([^,]+),\[([^]]+)\]
FORMAT = COL1::$1 COL2::$2 COL3::$3 COL4::$4 COL5::$5 COL6::$6 COL7::$7 COL8::$8 COL9::$9 COL10::$10 COL11::$11 COL12::$12 COL13::$13 COL14::$14
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;File&lt;/STRONG&gt; /tmp/my.log&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1,2,1411261200000,4,5,6,7,8,9,10,[11],12,13,[ALARM]
1,2,1411261200000,4,5,6,7,8,9,10,[11],12,13,[ALARM]
1,2,1411261200000,4,5,GCD244,7,8,9,10,[11,12,13,[ALARM]
1,2,1411261200000,4,5,6,7,8,9,10,[11],12,13,[ALARM]
1,2,1411261200000,4,5,6,7,8,9,10,[11,111,1111],12,13,[ALARM]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Splunk Web search:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://dl.dropboxusercontent.com/u/3244719/Screen%20Shot%202017-02-14%20at%2010.02.05.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 09:03:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285988#M54598</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-14T09:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285989#M54599</link>
      <description>&lt;P&gt;I believe that the props.conf and transforms.conf files need to be on your Search Head. Which, if you have just one Splunk Enterprise server, is the same as the Indexer.&lt;/P&gt;

&lt;P&gt;My understanding is that the Universal Forwarder doesn't do any 'processing'. You'd need to use a Heavy Forwarder for that.&lt;/P&gt;

&lt;P&gt;But as these props and transforms are after indexing, your Search Head (Splunk Server) is the place for them.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 09:07:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285989#M54599</guid>
      <dc:creator>gvmorley</dc:creator>
      <dc:date>2017-02-14T09:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285990#M54600</link>
      <description>&lt;P&gt;Also,&lt;/P&gt;

&lt;P&gt;Always have a go with this stuff on a development system first!&lt;/P&gt;

&lt;P&gt;I'd recommend running Splunk (with the Free License) on your laptop or PC, so that it's easy to test with.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 09:08:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285990#M54600</guid>
      <dc:creator>gvmorley</dc:creator>
      <dc:date>2017-02-14T09:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285991#M54601</link>
      <description>&lt;P&gt;You are right. &lt;BR /&gt;
I moved the props.conf and transforms.conf in the Search Head. Perfect!!&lt;/P&gt;

&lt;P&gt;But I don't understand why the first version of my props.conf was working (it was in the Universal Splunk forwarder). This confused me.&lt;/P&gt;

&lt;P&gt;Thank you again!!!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 09:17:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285991#M54601</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-14T09:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285992#M54602</link>
      <description>&lt;P&gt;Of course!!! &lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 09:17:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285992#M54602</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-14T09:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285993#M54603</link>
      <description>&lt;P&gt;No problem.&lt;/P&gt;

&lt;P&gt;Just to round off the 'why was props.conf working on the forwarder'...&lt;/P&gt;

&lt;P&gt;From looking at the manual here:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you look at the section on 'Structured Data Header Extraction and configuration', there's this:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;"This feature and all of its settings apply at input time, when data is first read by Splunk.  The setting is used on a Splunk system that has configured inputs acquiring the data."&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;So, as they apply at 'input' time, they get used by the forwarder, as it's the one with the configured input.&lt;/P&gt;

&lt;P&gt;At least that's my understanding!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 09:25:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285993#M54603</guid>
      <dc:creator>gvmorley</dc:creator>
      <dc:date>2017-02-14T09:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Log pre processing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285994#M54604</link>
      <description>&lt;P&gt;Well that's not what your original question said so my solution won't work for the updated version of your question.&lt;/P&gt;

&lt;P&gt;They were broke into different fields because of the comma delimiter. It was my understanding that you just needed to remove square brackets.  Happy you found your solution either way!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 12:07:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Log-pre-processing/m-p/285994#M54604</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-02-14T12:07:32Z</dc:date>
    </item>
  </channel>
</rss>

