<?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: How to write the regex for the removal of a header from a log file? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139992#M38570</link>
    <description>&lt;P&gt;Thanks for the quick response, I will give it a shot and I am working with sample logs until I get it sorted.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Feb 2015 00:42:10 GMT</pubDate>
    <dc:creator>Bliide</dc:creator>
    <dc:date>2015-02-10T00:42:10Z</dc:date>
    <item>
      <title>How to write the regex for the removal of a header from a log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139990#M38568</link>
      <description>&lt;P&gt;I am trying to remove the header from a log file.  I know that I need to put a stanza in props.conf on the forwarder and then create a transforms.conf like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[skip_header_logfile]
REGEX = &amp;lt;&amp;lt; 20-30 characters of your header line &amp;gt;&amp;gt;
DEST_KEY = queue
FORMAT = nullQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My problem is that my REGEX skills are horrible.  My log file looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Header&amp;gt;
  &amp;lt;Product&amp;gt;Microsoft SQL Server Reporting Services Version 2011.0110.2100.060 ((SQL11_RTM).120210-1917 )&amp;lt;/Product&amp;gt;
  &amp;lt;Locale&amp;gt;English (United States)&amp;lt;/Locale&amp;gt;
  &amp;lt;TimeZone&amp;gt;Central Standard Time&amp;lt;/TimeZone&amp;gt;
  &amp;lt;Path&amp;gt;C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\Logfiles\ReportServerService__01_06_2015_00_01_11.log&amp;lt;/Path&amp;gt;
  &amp;lt;SystemName&amp;gt;SERVER&amp;lt;/SystemName&amp;gt;
  &amp;lt;OSName&amp;gt;Microsoft Windows NT 6.1.7601 Service Pack 1&amp;lt;/OSName&amp;gt;
  &amp;lt;OSVersion&amp;gt;6.1.7601&amp;lt;/OSVersion&amp;gt;
  &amp;lt;ProcessID&amp;gt;10653&amp;lt;/ProcessID&amp;gt;
  &amp;lt;Virtualization&amp;gt;None&amp;lt;/Virtualization&amp;gt;
&amp;lt;/Header&amp;gt;
library!WindowsService_112!195c!01/06/2015-00:01:11:: i INFO: Call to CleanBatch()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All that I need is REGEX that will select everything from &lt;CODE&gt;to&lt;/CODE&gt; and of course include the header text, but I can not get it to work.  Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2015 00:03:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139990#M38568</guid>
      <dc:creator>Bliide</dc:creator>
      <dc:date>2015-02-10T00:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex for the removal of a header from a log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139991#M38569</link>
      <description>&lt;P&gt;AFAIK, having regex expression go to nullQueue will &lt;STRONG&gt;discard entire event&lt;/STRONG&gt;, not just the matched pattern. You should be looking for a SEDCMD. &lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
[your_sourcetype]
SEDCMD-null = s/(?s)&amp;lt;Header&amp;gt;.*(?=&amp;lt;\/Header&amp;gt;)&amp;lt;\/Header&amp;gt;//
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Having said so, proceed with caution as this works directly at index time and there is no way to get back lost data. I suggest you try the command on sample data before putting it into production.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2015 00:35:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139991#M38569</guid>
      <dc:creator>sk314</dc:creator>
      <dc:date>2015-02-10T00:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex for the removal of a header from a log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139992#M38570</link>
      <description>&lt;P&gt;Thanks for the quick response, I will give it a shot and I am working with sample logs until I get it sorted.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2015 00:42:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139992#M38570</guid>
      <dc:creator>Bliide</dc:creator>
      <dc:date>2015-02-10T00:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex for the removal of a header from a log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139993#M38571</link>
      <description>&lt;P&gt;Converted this to an answer.  Bliide, if you are still around could you check if this works and accept this answer, or otherwise comment back on what's still needed?&lt;/P&gt;</description>
      <pubDate>Sun, 01 Nov 2015 20:17:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-for-the-removal-of-a-header-from-a-log/m-p/139993#M38571</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-11-01T20:17:45Z</dc:date>
    </item>
  </channel>
</rss>

