<?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: Tie multiline data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81100#M20500</link>
    <description>&lt;P&gt;No, there are still newline characters in there, so to make Splunk match that regex you need to tell it to have a dot match newlines by including (?s) at the start of the regex.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Sep 2011 07:46:13 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2011-09-26T07:46:13Z</dc:date>
    <item>
      <title>Tie multiline data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81096#M20496</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;We have a sql log where the format is not conducive to a predictable pattern for delimiting. Or so i think. In any case, i am interested in tying two lines together based on time stamp of the entry in the log.&lt;/P&gt;

&lt;P&gt;These are two lines from the splunk search on the log file. The time in hh:mm:ss.microsecond format are the first line printed on each line as you all know. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;9/23/11
1:34:03.000 PM
SET timestamp=1316810043;
show table status from `lportal`;

    host=xyz.acmexyz.com   Options|  
    sourcetype=xyz_MasterDB_SlowQuery   Options|  
    source=/var/lib/mysql/data/slow-queries.log   Options





9/23/11
    1:34:03.000 PM  
    # Time: 110923 13:34:03
    # User@Host: readonly[readonly] @  [172.20.6.1]
    # Thread_id: 13978257  Schema: lportal  Last_errno: 0  Killed: 0
    # Query_time: 6.795079  Lock_time: 0.000058  Rows_sent: 294  Rows_examined: 294  Rows_affected: 0  Rows_read: 294
    # Bytes_sent: 34241  Tmp_tables: 1  Tmp_disk_tables: 0  Tmp_table_sizes: 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now i am interested in extracting Query time from #2nd set of events , which are upward of 1sec and associate it with the queries running during that Time. &lt;/P&gt;

&lt;P&gt;I could easily extract time stamp as rex ="Query_time:\s(?P&lt;QUERY_TIME&gt;\d+.\d+)\s+"&lt;/QUERY_TIME&gt;&lt;/P&gt;

&lt;P&gt;Now i want to tie this extracted query_time and take its timestamps and extract the query from first set of events.&lt;/P&gt;

&lt;P&gt;Any help is apreciated. &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:54:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81096#M20496</guid>
      <dc:creator>tven7</dc:creator>
      <dc:date>2020-09-28T09:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Tie multiline data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81097#M20497</link>
      <description>&lt;P&gt;If the timestamps for the two events are 100% identical, you could run &lt;CODE&gt;transaction&lt;/CODE&gt; on the &lt;CODE&gt;_time&lt;/CODE&gt; field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourbasesearch&amp;gt; | transaction _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That'll tie the two events together so you can get both the query and the result stats in the same combined event.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2011 21:03:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81097#M20497</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-09-23T21:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Tie multiline data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81098#M20498</link>
      <description>&lt;P&gt;that worked, thank you very much. &lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2011 22:21:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81098#M20498</guid>
      <dc:creator>tven7</dc:creator>
      <dc:date>2011-09-23T22:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Tie multiline data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81099#M20499</link>
      <description>&lt;P&gt;Did'nt create a seperate thread because its a continuation to the original QQ, but here is the next question in this query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Time: 110923 15:36:52
# User@Host: readonly[readonly] @  [172.20.6.1]
# Thread_id: 13984829  Schema: lportal  Last_errno: 0  Killed: 0
# Query_time: 6.230555  Lock_time: 0.000036  Rows_sent: 294  Rows_examined: 294  Rows_affected: 0  Rows_read: 294
# Bytes_sent: 34243  Tmp_tables: 1  Tmp_disk_tables: 0  Tmp_table_sizes: 0
SET timestamp=1316817412;
show table status from `lportal`;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;base search|transaction _time|rex ="(?m)Query_time:\s+(?P&lt;QUERY_TIME&gt;\d+.\d+)\s+Lock_time.*?SET\stimestamp=\d+;(?P&lt;QUERY&gt;[^ ]+?);"&lt;/QUERY&gt;&lt;/QUERY_TIME&gt;&lt;/P&gt;

&lt;P&gt;I was trying to extract Query_time and the query on the last line. And cant get it the extraction to work. &lt;/P&gt;

&lt;P&gt;Since its tied together by transaction _time, can you assume you dont need a new line character when you go from line to line?&lt;/P&gt;

&lt;P&gt;Any ideas how this can be achieved? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:54:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81099#M20499</guid>
      <dc:creator>tven7</dc:creator>
      <dc:date>2020-09-28T09:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Tie multiline data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81100#M20500</link>
      <description>&lt;P&gt;No, there are still newline characters in there, so to make Splunk match that regex you need to tell it to have a dot match newlines by including (?s) at the start of the regex.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2011 07:46:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81100#M20500</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-09-26T07:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Tie multiline data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81101#M20501</link>
      <description>&lt;P&gt;thank you it worked.&lt;/P&gt;

&lt;P&gt;|transaction _time|rex "(?s)Query_time:\s+(?P&lt;MASTERDB_QUERY_TIME&gt;\d+.\d+)\s+Lock_time.&lt;EM&gt;?SET\stimestamp=\d+;\n(?P&lt;MASTERDB_QUERY&gt;.&lt;/MASTERDB_QUERY&gt;&lt;/EM&gt;?);"|table masterdb_query_time masterdb_query|sort -masterdb_query_time|head 10&lt;/MASTERDB_QUERY_TIME&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:55:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tie-multiline-data/m-p/81101#M20501</guid>
      <dc:creator>tven7</dc:creator>
      <dc:date>2020-09-28T09:55:47Z</dc:date>
    </item>
  </channel>
</rss>

