<?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 time from multi line log in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214302#M42140</link>
    <description>&lt;P&gt;Dears,&lt;/P&gt;

&lt;P&gt;i have log that repeated every  10 min as below &lt;BR /&gt;
16-02-08  Name                         Succ    drop &lt;/P&gt;

&lt;P&gt;04:26:50  Searches                       12       0 &lt;BR /&gt;
04:27:00  Searches                       17       0 &lt;BR /&gt;
04:27:10  Searches                       12       0 &lt;/P&gt;

&lt;P&gt;firts line contain Date of the Day and each line contain different Timestamp &lt;BR /&gt;
i need to know how to extract each line with exact time &lt;BR /&gt;
i know that i can break events using Break_line option and also break multiple events using multikv &lt;BR /&gt;
but i couldn't extract Correct time for every event So please advise &lt;/P&gt;</description>
    <pubDate>Sun, 21 Feb 2016 14:18:01 GMT</pubDate>
    <dc:creator>ahmedhassanean</dc:creator>
    <dc:date>2016-02-21T14:18:01Z</dc:date>
    <item>
      <title>how to extract time from multi line log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214302#M42140</link>
      <description>&lt;P&gt;Dears,&lt;/P&gt;

&lt;P&gt;i have log that repeated every  10 min as below &lt;BR /&gt;
16-02-08  Name                         Succ    drop &lt;/P&gt;

&lt;P&gt;04:26:50  Searches                       12       0 &lt;BR /&gt;
04:27:00  Searches                       17       0 &lt;BR /&gt;
04:27:10  Searches                       12       0 &lt;/P&gt;

&lt;P&gt;firts line contain Date of the Day and each line contain different Timestamp &lt;BR /&gt;
i need to know how to extract each line with exact time &lt;BR /&gt;
i know that i can break events using Break_line option and also break multiple events using multikv &lt;BR /&gt;
but i couldn't extract Correct time for every event So please advise &lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2016 14:18:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214302#M42140</guid>
      <dc:creator>ahmedhassanean</dc:creator>
      <dc:date>2016-02-21T14:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract time from multi line log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214303#M42141</link>
      <description>&lt;P&gt;Not sure I understand. Can you describe your desired outcome?&lt;BR /&gt;
Do you want these to be one event? Do you want each line to be one event, with all the lines that don't have a date in it using... which date?&lt;BR /&gt;
Do you have the opportunity to change the application generating these logs?&lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2016 20:56:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214303#M42141</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2016-02-21T20:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract time from multi line log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214304#M42142</link>
      <description>&lt;P&gt;i would like to have each line as new event but with correct time and column name as below ( note : date is come in first line only in our case (16-02-08 ) and for each line there is different date and all this table is repeated every 2 min in log with header ) &lt;/P&gt;

&lt;P&gt;16-02-08 04:26:50 Searches 12 0&lt;BR /&gt;
16-02-08 04:27:00 Searches 17 0&lt;BR /&gt;
16-02-08 04:27:10 Searches 12 0 &lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2016 21:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214304#M42142</guid>
      <dc:creator>ahmedhassanean</dc:creator>
      <dc:date>2016-02-21T21:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract time from multi line log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214305#M42143</link>
      <description>&lt;P&gt;That's super ugly. If the event really looks like that, and there's nothing you can do about it, then you could do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats count
| eval _raw="16-02-08 Name Succ drop\n04:26:50 Searches 12 0\n04:27:00 Searches 17 0\n04:27:10 Searches 12 0"
| rex "^(?&amp;lt;date&amp;gt;\d+-\d+-\d+) "
| eval line=split(_raw,"\n")
| mvexpand line
| rex field=line "^(?&amp;lt;time&amp;gt;\d+:\d+:\d+) "
| eval _time=strptime(date + " " + time, "%d-%m-%y %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It isn't going to be fast, though. You'd be far better off figuring out how to parse the logs line by line, if at all possible.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Mar 2016 07:45:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-extract-time-from-multi-line-log/m-p/214305#M42143</guid>
      <dc:creator>vbumgarner</dc:creator>
      <dc:date>2016-03-13T07:45:55Z</dc:date>
    </item>
  </channel>
</rss>

