<?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: CSV Event Separation in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652698#M110775</link>
    <description>&lt;P&gt;Hi JGP,&lt;/P&gt;&lt;P&gt;You can create your own custom sourcetype to parse the events separately.&lt;BR /&gt;Let me give you an example :&amp;nbsp;&lt;BR /&gt;My Sample Data -&amp;nbsp;&lt;BR /&gt;Test ID,name&lt;BR /&gt;1,test1&lt;BR /&gt;2,test2&lt;BR /&gt;Test ID,name&lt;BR /&gt;3,test3&lt;BR /&gt;4,test4&lt;BR /&gt;Test ID,name&lt;BR /&gt;5,test5&lt;BR /&gt;6,test6&lt;BR /&gt;&lt;BR /&gt;My Sourcetype configuration -&amp;nbsp;&lt;BR /&gt;[test_csv]&lt;BR /&gt;LINE_BREAKER=(\n+)Test&lt;BR /&gt;SHOULD_LINEMERGE=true&lt;BR /&gt;&lt;BR /&gt;NOTE - You can define the other parameters as per your need.&lt;/P&gt;&lt;P&gt;This is how it parses the data :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dhruv_0-1690885965447.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26569iDE24121C310B242D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dhruv_0-1690885965447.png" alt="dhruv_0-1690885965447.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you want to extract fields, You can write your own REGEX to do it.&lt;BR /&gt;Here is how I did it using "REX" command. Just to showcase :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dhruv_1-1690886082812.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26570i6018B0455C2F40CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dhruv_1-1690886082812.png" alt="dhruv_1-1690886082812.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The query :&amp;nbsp;&lt;BR /&gt;source="testing.csv" host="so1" index="test_csv" sourcetype="test_csv"&lt;BR /&gt;| rex "(?&amp;lt;Test_ID&amp;gt;\d+),(?&amp;lt;name&amp;gt;.*)" max_match=0&lt;BR /&gt;| table Test_ID,name&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Aug 2023 10:35:11 GMT</pubDate>
    <dc:creator>dhruv</dc:creator>
    <dc:date>2023-08-01T10:35:11Z</dc:date>
    <item>
      <title>How to do CSV Event Separation?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652224#M110746</link>
      <description>&lt;P&gt;We want event to separated for each header whenever there is new entry in the csv file. what would be the props applied to the sourcetype to have a single event&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sample file&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JGP_0-1690466270798.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26504iADB47B8D81E25E68/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JGP_0-1690466270798.png" alt="JGP_0-1690466270798.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want details in one event whenever there is header inserted in csv file&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JGP_1-1690466493598.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26505i9BCBE57CCA18BAEB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JGP_1-1690466493598.png" alt="JGP_1-1690466493598.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;please suggest&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 18:33:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652224#M110746</guid>
      <dc:creator>JGP</dc:creator>
      <dc:date>2023-08-01T18:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: CSV Event Separation</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652698#M110775</link>
      <description>&lt;P&gt;Hi JGP,&lt;/P&gt;&lt;P&gt;You can create your own custom sourcetype to parse the events separately.&lt;BR /&gt;Let me give you an example :&amp;nbsp;&lt;BR /&gt;My Sample Data -&amp;nbsp;&lt;BR /&gt;Test ID,name&lt;BR /&gt;1,test1&lt;BR /&gt;2,test2&lt;BR /&gt;Test ID,name&lt;BR /&gt;3,test3&lt;BR /&gt;4,test4&lt;BR /&gt;Test ID,name&lt;BR /&gt;5,test5&lt;BR /&gt;6,test6&lt;BR /&gt;&lt;BR /&gt;My Sourcetype configuration -&amp;nbsp;&lt;BR /&gt;[test_csv]&lt;BR /&gt;LINE_BREAKER=(\n+)Test&lt;BR /&gt;SHOULD_LINEMERGE=true&lt;BR /&gt;&lt;BR /&gt;NOTE - You can define the other parameters as per your need.&lt;/P&gt;&lt;P&gt;This is how it parses the data :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dhruv_0-1690885965447.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26569iDE24121C310B242D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dhruv_0-1690885965447.png" alt="dhruv_0-1690885965447.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you want to extract fields, You can write your own REGEX to do it.&lt;BR /&gt;Here is how I did it using "REX" command. Just to showcase :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dhruv_1-1690886082812.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26570i6018B0455C2F40CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dhruv_1-1690886082812.png" alt="dhruv_1-1690886082812.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The query :&amp;nbsp;&lt;BR /&gt;source="testing.csv" host="so1" index="test_csv" sourcetype="test_csv"&lt;BR /&gt;| rex "(?&amp;lt;Test_ID&amp;gt;\d+),(?&amp;lt;name&amp;gt;.*)" max_match=0&lt;BR /&gt;| table Test_ID,name&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 10:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652698#M110775</guid>
      <dc:creator>dhruv</dc:creator>
      <dc:date>2023-08-01T10:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: CSV Event Separation</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652701#M110776</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254265"&gt;@JGP&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will you please elaborate the query.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 12:26:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652701#M110776</guid>
      <dc:creator>Praz_123</dc:creator>
      <dc:date>2023-08-01T12:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: CSV Event Separation</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652711#M110779</link>
      <description>&lt;P&gt;&lt;SPAN&gt;source="testing.csv" host="so1" index="test_csv" sourcetype="test_csv"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| rex "(?&amp;lt;Test_ID&amp;gt;\d+),(?&amp;lt;name&amp;gt;.*)" max_match=0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| table Test_ID,name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1.&amp;nbsp;source="testing.csv" host="so1" index="test_csv" sourcetype="test_csv" - This is just searching for a particular index, source, sourcetype.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;SPAN&gt;| rex "(?&amp;lt;Test_ID&amp;gt;\d+),(?&amp;lt;name&amp;gt;.*)" max_match=0 -&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;rex - It extracts fields inline from the events. The field extraction is not permanent.&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/9.0.2305/SearchReference/Rex" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/9.0.2305/SearchReference/Rex&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;"(?&amp;lt;Test_ID&amp;gt;\d+),(?&amp;lt;name&amp;gt;.*)" - It is regular expression as per my sample data. Try&amp;nbsp;&lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt;&amp;nbsp;for building the regex as per your data.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;max_match=0 - It will allow rex command to match all matching field-values. Otherwise rex will only match the first occurrence.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 13:45:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-do-CSV-Event-Separation/m-p/652711#M110779</guid>
      <dc:creator>dhruv</dc:creator>
      <dc:date>2023-08-01T13:45:59Z</dc:date>
    </item>
  </channel>
</rss>

