<?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 rex for complex data in Other Usage</title>
    <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569586#M971</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;Could someone help me with the field extraction for the below complex data(1000 lines of data I concised to 10 lines of data ) :&lt;/P&gt;&lt;P&gt;columns to be extracted are&amp;nbsp;statement_text , cnt, total_reads, total_writes,&amp;nbsp;db_name&lt;/P&gt;&lt;P&gt;statement_text="insert into #pt_queryhistory_time (&lt;BR /&gt;[sample_time],command_id,cnt,total_time,[db_name],sqlhandle,hash_char) select top 500&lt;BR /&gt;[sample_time] = convert(smalldatetime,'2021-09-27 18:55:00'),&lt;BR /&gt;total_time = qs.total_elapsed_time/1000,&lt;BR /&gt;avg_cpu = case when qs.execution_count = 0 then 0 else qs.total_worker_time/qs.execution_count/1000 end,&lt;BR /&gt;db_name = case convert(int, pa.value) when null then '--unknown--' when 0 then '--unknown--' when 32767 then 'Resource' else db_name(convert(int, pa.value)) end,&lt;BR /&gt;[db_id] = coalesce(convert(int, pa.value),0),&lt;BR /&gt;hash_char = '' from sys.db_stats (nolock) as qs cross apply sys.dm_exec_plan_attributes(qs.plan_handle)as pa&lt;BR /&gt;where pa.attribute = N'dbid' and isnull(convert(int,pa.value),0) = 8&lt;BR /&gt;order by qs.total_elapsed_time desc",&lt;BR /&gt;cnt="1", total_reads="1888", total_writes="29", avg_writes="29",db_name="db1"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't able to extract the statement_text column completely and the remaining columns are working fine&lt;/P&gt;&lt;P&gt;index="index" source="source1"| rex field=_raw "statement_text\=\"(?&amp;lt;statement_text&amp;gt;[@ ( ) $ . , \"A-Z ! ^ | \" - _ : { } A-Z a-z _ 0-9]+]+)\""&amp;nbsp;&amp;nbsp; | rex field=_raw "cnt\=\"(?&amp;lt;cnt&amp;gt;[0-9]+)\"" | rex field=_raw "diff_reads\=\"(?&amp;lt;diff_reads&amp;gt;[0-9]+)\""| rex field=_raw "total_writes\=\"(?&amp;lt;total_writes&amp;gt;[0-9]+)\""&amp;nbsp;| rex field=_raw "db_name\=\"(?&amp;lt;db_name&amp;gt;[A-Z a-z _ 0-9]+)\""&lt;/P&gt;&lt;P&gt;Please provide me rex for statement_text column where the data can be extracted till the 2nd column "cnt"&lt;/P&gt;</description>
    <pubDate>Mon, 04 Oct 2021 17:39:13 GMT</pubDate>
    <dc:creator>Supriya</dc:creator>
    <dc:date>2021-10-04T17:39:13Z</dc:date>
    <item>
      <title>rex for complex data</title>
      <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569586#M971</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;Could someone help me with the field extraction for the below complex data(1000 lines of data I concised to 10 lines of data ) :&lt;/P&gt;&lt;P&gt;columns to be extracted are&amp;nbsp;statement_text , cnt, total_reads, total_writes,&amp;nbsp;db_name&lt;/P&gt;&lt;P&gt;statement_text="insert into #pt_queryhistory_time (&lt;BR /&gt;[sample_time],command_id,cnt,total_time,[db_name],sqlhandle,hash_char) select top 500&lt;BR /&gt;[sample_time] = convert(smalldatetime,'2021-09-27 18:55:00'),&lt;BR /&gt;total_time = qs.total_elapsed_time/1000,&lt;BR /&gt;avg_cpu = case when qs.execution_count = 0 then 0 else qs.total_worker_time/qs.execution_count/1000 end,&lt;BR /&gt;db_name = case convert(int, pa.value) when null then '--unknown--' when 0 then '--unknown--' when 32767 then 'Resource' else db_name(convert(int, pa.value)) end,&lt;BR /&gt;[db_id] = coalesce(convert(int, pa.value),0),&lt;BR /&gt;hash_char = '' from sys.db_stats (nolock) as qs cross apply sys.dm_exec_plan_attributes(qs.plan_handle)as pa&lt;BR /&gt;where pa.attribute = N'dbid' and isnull(convert(int,pa.value),0) = 8&lt;BR /&gt;order by qs.total_elapsed_time desc",&lt;BR /&gt;cnt="1", total_reads="1888", total_writes="29", avg_writes="29",db_name="db1"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't able to extract the statement_text column completely and the remaining columns are working fine&lt;/P&gt;&lt;P&gt;index="index" source="source1"| rex field=_raw "statement_text\=\"(?&amp;lt;statement_text&amp;gt;[@ ( ) $ . , \"A-Z ! ^ | \" - _ : { } A-Z a-z _ 0-9]+]+)\""&amp;nbsp;&amp;nbsp; | rex field=_raw "cnt\=\"(?&amp;lt;cnt&amp;gt;[0-9]+)\"" | rex field=_raw "diff_reads\=\"(?&amp;lt;diff_reads&amp;gt;[0-9]+)\""| rex field=_raw "total_writes\=\"(?&amp;lt;total_writes&amp;gt;[0-9]+)\""&amp;nbsp;| rex field=_raw "db_name\=\"(?&amp;lt;db_name&amp;gt;[A-Z a-z _ 0-9]+)\""&lt;/P&gt;&lt;P&gt;Please provide me rex for statement_text column where the data can be extracted till the 2nd column "cnt"&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 17:39:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569586#M971</guid>
      <dc:creator>Supriya</dc:creator>
      <dc:date>2021-10-04T17:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: rex for complex data</title>
      <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569592#M973</link>
      <description>&lt;P&gt;Would this work for you?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=_raw "statement_text\=\"(?&amp;lt;statement_text&amp;gt;[^\"]+)\""&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 04 Oct 2021 18:34:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569592#M973</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-04T18:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: rex for complex data</title>
      <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569594#M974</link>
      <description>&lt;P&gt;Give this a try for statement_text field extraction&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "statement_text=\"(?m)(?&amp;lt;statement_text&amp;gt;(.+[\r\n])+[^\"]+)\","&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 04 Oct 2021 18:41:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569594#M974</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2021-10-04T18:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: rex for complex data</title>
      <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569610#M975</link>
      <description>&lt;P&gt;In the case that you end up with escaped double quotes embedded in your string (e.g. "this is \"just\" what the doctor ordered") you will need to have a slightly different regex. Something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=_raw "statement_text\=\"(?&amp;lt;statement_text&amp;gt;(\\"|[^\"])+)\""&lt;/LI-CODE&gt;&lt;P&gt;This should work for any number of singly-escaped double quotes in your string. I only add this because of the chance of a double quote ending up in there somewhere with such a long, unstructured string.&lt;/P&gt;&lt;P&gt;There is also the strange possibility that there could be unescaped double quotes, which might require something like:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|rex field=_raw "statement_text\=\"(?&amp;lt;statement_text&amp;gt;[\s\S]+)\",\s*cnt=\""&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 04 Oct 2021 21:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569610#M975</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2021-10-04T21:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: rex for complex data</title>
      <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569669#M976</link>
      <description>&lt;P&gt;Thank you everyone for your inputs!&lt;/P&gt;&lt;P&gt;Out of all only the below rex is working for my data, thank you @&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120445" target="_self"&gt;&lt;SPAN class="login-bold"&gt;cpetterborg&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;|rex field=_raw "statement_text\=\"(?&amp;lt;statement_text&amp;gt;[\s\S]+)\",\s*cnt=\""&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here one more issue I have is while downloading the results in CSV file, the column statement_text is splitting in different rows. could you help me with this issue&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 11:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569669#M976</guid>
      <dc:creator>Supriya</dc:creator>
      <dc:date>2021-10-05T11:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: rex for complex data</title>
      <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569804#M977</link>
      <description>&lt;P&gt;What do you mean by "&lt;SPAN&gt;the column statement_text is splitting in different rows"? Do you mean that there are more rows because there are "unintended" newlines among your CSV file? Is that because there are newlines in the statement text? Or is there something else that I'm not understanding?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 22:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569804#M977</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2021-10-05T22:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: rex for complex data</title>
      <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569834#M978</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120445"&gt;@cpetterborg&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;In splunk cloud I have 500+ events and each event contains 100+ lines of data. while exporting in CSV file single event is splitting in different rows which should not happen. I need the data same as the splunk results row wise without splitting&lt;/P&gt;&lt;P&gt;Is there an limitation per single row while exporting in csv file?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Supriya_0-1633501808734.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16293iE1533B8C5737ED95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Supriya_0-1633501808734.png" alt="Supriya_0-1633501808734.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the screenshot for reference, where 2nd and 3rd rows are single event(but splitted in 2 rows) and&amp;nbsp;5&amp;amp;6 single event and 8&amp;amp;9 single event,&amp;nbsp; data from&amp;nbsp;4th and 7th row is fine&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 17:50:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/569834#M978</guid>
      <dc:creator>Supriya</dc:creator>
      <dc:date>2021-10-07T17:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: rex for complex data</title>
      <link>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/570115#M979</link>
      <description>&lt;P&gt;Are your events so long that they are being split before the end of the event? Look at the raw events. If you have a raw event that this is happening on, please provide a "cleaned" version of the event here, both in the raw version that is the original, but also the _raw value in splunk, in case there are differences.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 19:04:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/rex-for-complex-data/m-p/570115#M979</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2021-10-07T19:04:21Z</dc:date>
    </item>
  </channel>
</rss>

