<?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 Fields extraction in file with single and multiline logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381610#M111612</link>
    <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I'm new in splunk. I currently want to analyse a log file. I'm facing issues to extract informations because each lines contain different informations. The file contain single and multiline logs. &lt;/P&gt;

&lt;P&gt;Here is an example of the log file : &lt;/P&gt;

&lt;P&gt;I want to extract generale information like the timestamp (2019-02-08 00:40:03) and the status (INFO|TRACE or other message).&lt;/P&gt;

&lt;P&gt;And i also want to be able to extract other infromations in each log line. &lt;/P&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
    <pubDate>Wed, 13 Feb 2019 15:41:20 GMT</pubDate>
    <dc:creator>clementros</dc:creator>
    <dc:date>2019-02-13T15:41:20Z</dc:date>
    <item>
      <title>Fields extraction in file with single and multiline logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381610#M111612</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I'm new in splunk. I currently want to analyse a log file. I'm facing issues to extract informations because each lines contain different informations. The file contain single and multiline logs. &lt;/P&gt;

&lt;P&gt;Here is an example of the log file : &lt;/P&gt;

&lt;P&gt;I want to extract generale information like the timestamp (2019-02-08 00:40:03) and the status (INFO|TRACE or other message).&lt;/P&gt;

&lt;P&gt;And i also want to be able to extract other infromations in each log line. &lt;/P&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 15:41:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381610#M111612</guid>
      <dc:creator>clementros</dc:creator>
      <dc:date>2019-02-13T15:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Fields extraction in file with single and multiline logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381611#M111613</link>
      <description>&lt;P&gt;If the log file was onboarded properly, Splunk will be breaking the file into events every time there is a timestamp at the beginning of the line and this timestamp will be put into the &lt;CODE&gt;_time&lt;/CODE&gt; field.  So there is no reason to extract the timestamp again.  If you need it presented in a different way, just do &lt;CODE&gt;| eval timestamp=strftime(_time, "Your Time Format Here")&lt;/CODE&gt;  To get the other fields, you just need to create appropriate RegEx strings.  For example, you can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| . rex "[\r\n\s]+\[TRACE]\s+Reason\s+{\s+(?&amp;lt;Reason&amp;gt;[^\r\n]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Feb 2019 00:57:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381611#M111613</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-14T00:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Fields extraction in file with single and multiline logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381612#M111614</link>
      <description>&lt;P&gt;Thanks for your answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;So i need to build a regex for every field extraction ? &lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 07:59:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381612#M111614</guid>
      <dc:creator>clementros</dc:creator>
      <dc:date>2019-02-14T07:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fields extraction in file with single and multiline logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381613#M111615</link>
      <description>&lt;P&gt;Either that or you need to clip out all of the extra junk to reconstruct the original JSON and pass it to &lt;CODE&gt;spath&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 08:03:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fields-extraction-in-file-with-single-and-multiline-logs/m-p/381613#M111615</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-14T08:03:02Z</dc:date>
    </item>
  </channel>
</rss>

