<?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 to extract and apply header information to every log line? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218653#M64257</link>
    <description>&lt;P&gt;Hello Splunk Guru's,&lt;/P&gt;

&lt;P&gt;The file below contains a header of 7 lines followed by an undetermined number of log lines.  I would like for the header to apply to each and every log line.  For instance, I would like to be able to search on our Version=6 and find all log lines associated with this version.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Timestamp=2016-01-08T14:29:20
SmartRecorderSN=HL3BC085
Version=6
FirmwareVersion=3.09.14
EventDurationSetpoint=30
BlackoutSetpoint=5
Iteration=322966

TRAT2,HL3BC085201601081429001212ER.SDE,2016-01-08T14:29:01,521,0.0004,0.000000,0.000000,1.0000,-1.5000,1,-0.0016,1.0000
ECR,HL3BC085201601081429001212ER.SDE,9,2016-01-08T14:29:00,00000,1,521,3326464,0,0.000000,0.000000
ECR,HL3BC085201601081429135674CDR.SDE,9,2016-01-08T14:29:13,00000,1,429,3345602,0,0.000000,0.000000
TRC,HL3BC085201601081429135674CDR.SDE,2016-01-08T14:29:13,429,0.000000,0.000000,0,0,30,1,1,0,-1,-1
TRAT2,HL3BC085201601081429291213ER.SDE,2016-01-08T14:29:27,521,0.0004,0.000000,0.000000,1.0000,-1.5000,1,-0.0016,1.0000
ECR,HL3BC085201601081429291213ER.SDE,9,2016-01-08T14:29:27,00000,1,521,3388928,1,0.000000,0.000000
ECR,HL3BC085201601081429435675CDR.SDE,9,2016-01-08T14:29:43,00000,1,429,3357073,0,0.000000,0.000000
TRC,HL3BC085201601081429435675CDR.SDE,2016-01-08T14:29:43,429,0.000000,0.000000,0,0,30,1,1,0,-1,-1
EndTimeStamp=2016-01-08T14:30:02
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Rob&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jan 2016 00:30:38 GMT</pubDate>
    <dc:creator>RReichel</dc:creator>
    <dc:date>2016-01-09T00:30:38Z</dc:date>
    <item>
      <title>How to extract and apply header information to every log line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218653#M64257</link>
      <description>&lt;P&gt;Hello Splunk Guru's,&lt;/P&gt;

&lt;P&gt;The file below contains a header of 7 lines followed by an undetermined number of log lines.  I would like for the header to apply to each and every log line.  For instance, I would like to be able to search on our Version=6 and find all log lines associated with this version.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Timestamp=2016-01-08T14:29:20
SmartRecorderSN=HL3BC085
Version=6
FirmwareVersion=3.09.14
EventDurationSetpoint=30
BlackoutSetpoint=5
Iteration=322966

TRAT2,HL3BC085201601081429001212ER.SDE,2016-01-08T14:29:01,521,0.0004,0.000000,0.000000,1.0000,-1.5000,1,-0.0016,1.0000
ECR,HL3BC085201601081429001212ER.SDE,9,2016-01-08T14:29:00,00000,1,521,3326464,0,0.000000,0.000000
ECR,HL3BC085201601081429135674CDR.SDE,9,2016-01-08T14:29:13,00000,1,429,3345602,0,0.000000,0.000000
TRC,HL3BC085201601081429135674CDR.SDE,2016-01-08T14:29:13,429,0.000000,0.000000,0,0,30,1,1,0,-1,-1
TRAT2,HL3BC085201601081429291213ER.SDE,2016-01-08T14:29:27,521,0.0004,0.000000,0.000000,1.0000,-1.5000,1,-0.0016,1.0000
ECR,HL3BC085201601081429291213ER.SDE,9,2016-01-08T14:29:27,00000,1,521,3388928,1,0.000000,0.000000
ECR,HL3BC085201601081429435675CDR.SDE,9,2016-01-08T14:29:43,00000,1,429,3357073,0,0.000000,0.000000
TRC,HL3BC085201601081429435675CDR.SDE,2016-01-08T14:29:43,429,0.000000,0.000000,0,0,30,1,1,0,-1,-1
EndTimeStamp=2016-01-08T14:30:02
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Rob&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 00:30:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218653#M64257</guid>
      <dc:creator>RReichel</dc:creator>
      <dc:date>2016-01-09T00:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and apply header information to every log line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218654#M64258</link>
      <description>&lt;P&gt;Right now, EACH of those lines comes through as one event?&lt;/P&gt;

&lt;P&gt;I'm thinking we need to fix your event breaking first then deal with any fallout after that, but it depends on your answer to the previous question.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 00:51:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218654#M64258</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-01-09T00:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and apply header information to every log line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218655#M64259</link>
      <description>&lt;P&gt;You are correct. Right each of these lines are interpreted as one event (and hence missing the header info).&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 00:57:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218655#M64259</guid>
      <dc:creator>abhijitp</dc:creator>
      <dc:date>2016-01-09T00:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and apply header information to every log line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218656#M64260</link>
      <description>&lt;P&gt;We need to make your event break properly, meaning that whole group should be a single event.  To do this, you would need something like the following in your etc/apps/MyApp/local/props.conf (or etc/system/local/props.conf if you don't have this in an app).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype-to-break]
SHOULD_LINEMERGE = True
BREAK_ONLY_BEFORE = ^Timestamp=
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That &lt;EM&gt;should&lt;/EM&gt; make any new events that get indexed have all entire group be one event.  There is more information on breaking events correctly in the docs for &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.2/Data/Indexmulti-lineevents"&gt;configuring event linebreaking&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;Obviously, change "sourcetype-to-break" to your sourcetype you have set on that input.  You are manually setting a sourcetype on the input, aren't you?  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Now, one thing this might do is mess up the timestamping of events, so check that. I don't THINK this will be a problem but I wanted to mention it just in case.  So, if you have problems where events don't come in with the time stamp set to whatever's in the "Timestamp=" line, then be sure to post back because that should be easy to fix.  &lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 02:19:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218656#M64260</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-01-09T02:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and apply header information to every log line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218657#M64261</link>
      <description>&lt;P&gt;Hi Rich,  &lt;/P&gt;

&lt;P&gt;Thank you for your quick response!  Your answer created a single event for me containing all of the log lines.  This will work for what I initially asked which was to search the events by version.&lt;/P&gt;

&lt;P&gt;However, I failed to mention that I would also like to have each log line as it's own event so that I can extract many different fields from it.  For instance, take a look at the two lines below.  &lt;/P&gt;

&lt;P&gt;ECR,HL3BC085201601081429001212ER.SDE,9,2016-01-08T14:29:00,00000,1,521,3326464,0,0.000000,0.000000&lt;/P&gt;

&lt;P&gt;ECR,HL3BC085201601081429135674CDR.SDE,9,2016-01-08T14:29:13,00000,1,429,3345602,0,0.000000,0.000000&lt;/P&gt;

&lt;P&gt;If these were in the same event, then when I try to extract the second field there would be two different values: HL3BC085201601081429001212ER.SDE and HL3BC085201601081429135674CDR.SDE.  &lt;/P&gt;

&lt;P&gt;Please pardon my ignorance as I am fairly new to splunk.  If it is possible I would like to get that header information to essentially act as a default field such as "source" that applies to each log line (event) in the source file.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 18:58:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218657#M64261</guid>
      <dc:creator>RReichel</dc:creator>
      <dc:date>2016-01-11T18:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and apply header information to every log line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218658#M64262</link>
      <description>&lt;P&gt;To answer your other questions, I am manually setting a sourcetype on the input and the Timestamp was coming through just fine with your solution.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 19:01:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218658#M64262</guid>
      <dc:creator>RReichel</dc:creator>
      <dc:date>2016-01-11T19:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and apply header information to every log line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218659#M64263</link>
      <description>&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/122078/how-to-handle-metadata-in-file-headers.html"&gt;https://answers.splunk.com/answers/122078/how-to-handle-metadata-in-file-headers.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It seems someone else has already asked this question. So in my understanding, to get splunk to process the file the way I want, I need to modify the file before it gets into splunk with the header information appended to each line.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 20:48:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-apply-header-information-to-every-log-line/m-p/218659#M64263</guid>
      <dc:creator>RReichel</dc:creator>
      <dc:date>2016-01-11T20:48:46Z</dc:date>
    </item>
  </channel>
</rss>

