<?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: How to export Splunk data to CSV file using Javascript in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593439#M12208</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/93915"&gt;@VatsalJagani&lt;/a&gt;&amp;nbsp;string has more than 600 characters&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Apr 2022 11:57:44 GMT</pubDate>
    <dc:creator>ND</dc:creator>
    <dc:date>2022-04-12T11:57:44Z</dc:date>
    <item>
      <title>How to export Splunk data to CSV file using Javascript</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593149#M12181</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am using Javascript file to export splunk data from dashboard to CSV file.&lt;/P&gt;&lt;P&gt;Issue I am facing is : for few records where strings are long , data is breaking into next line.&lt;/P&gt;&lt;P&gt;I want to wrap those long strings in&amp;nbsp; " " to stop breaking data to next line. below is my code.&lt;/P&gt;&lt;P&gt;could someone please help me to get expected result&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$('#exportBtn').on('click',function(e){
var searchObj= mvc.components.getInstance("rrc_main");
var myResults = searchObj.data('results',{
output_mode : 'json_rows',
count:0
});
myResults.on("data",function(){
if(myResults.hasData()){
var data= myResults.data().fields.tostring().replace("Edit,","");
var rows = myresults.data().rows;
$.each(rows, function(row){

data = data+ "\n";
for(var i=0; i&amp;lt; 53; i++){
if(rows[row][i]==="edit"){
continue;
}
if(rows[row][i]== null){
data= data +"\"\",";
}else{
data = data +"\""+ rows[row][i].tostring()+"\",";
}
}
});&lt;/LI-CODE&gt;&lt;P&gt;Kindly help to wrap long strings in&amp;nbsp; " "&amp;nbsp; to read csv in proper format without breaking long strings in next line.&lt;/P&gt;&lt;P&gt;Appreciate your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;ND&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 19:53:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593149#M12181</guid>
      <dc:creator>ND</dc:creator>
      <dc:date>2022-04-08T19:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to export Splunk data to CSV file using Javascript</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593171#M12186</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226776"&gt;@ND&lt;/a&gt;&amp;nbsp;- I don't long strings could create any problems with CSV.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though there could be an issue where your string/field-value itself has a newline character (\n) in it. You can try replacing below line into your code&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data = data +"\""+ rows[row][i].tostring()+"\",";&lt;/LI-CODE&gt;&lt;P&gt;with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data = data +"\""+ rows[row][i].tostring().replace("\n","\\n")+"\",";&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Please make sure you are reading the CSV file without wrapping it in a text editor, or try reading it in Excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!!!&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2022 07:01:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593171#M12186</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-04-09T07:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to export Splunk data to CSV file using Javascript</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593320#M12198</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/93915"&gt;@VatsalJagani&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is no new line \n character or not even " in between string still that long string is breaking&amp;nbsp; into new line.&lt;/P&gt;&lt;P&gt;kindly suggest on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Neha&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 15:33:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593320#M12198</guid>
      <dc:creator>ND</dc:creator>
      <dc:date>2022-04-11T15:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to export Splunk data to CSV file using Javascript</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593324#M12199</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226776"&gt;@ND&lt;/a&gt;&amp;nbsp;- Generally Splunk should not do anything like that.&lt;/P&gt;&lt;P&gt;What is the usual length of those strings?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 15:49:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593324#M12199</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-04-11T15:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to export Splunk data to CSV file using Javascript</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593439#M12208</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/93915"&gt;@VatsalJagani&lt;/a&gt;&amp;nbsp;string has more than 600 characters&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 11:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593439#M12208</guid>
      <dc:creator>ND</dc:creator>
      <dc:date>2022-04-12T11:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to export Splunk data to CSV file using Javascript</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593445#M12209</link>
      <description>&lt;P&gt;I don't think Splunk is creating any problem. Because as such there is no limit or behavior of Splunk doing a funky things. Please check how you are reading the files.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/What-is-the-permissible-field-value-length/m-p/517236" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/What-is-the-permissible-field-value-length/m-p/517236&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 12:26:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593445#M12209</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-04-12T12:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to export Splunk data to CSV file using Javascript</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593449#M12210</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226776"&gt;@ND&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you please share some sample data from `rrc_main` search manager and the expected CSV output from those samples. It would be really helpful to understand your requirements and the issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;KV&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 12:43:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-export-Splunk-data-to-CSV-file-using-Javascript/m-p/593449#M12210</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2022-04-12T12:43:02Z</dc:date>
    </item>
  </channel>
</rss>

