<?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: Question on shell script for linux in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520265#M9297</link>
    <description>&lt;P&gt;if your API doesn't have auth then you can directly call API request from Splunk Enterprise security. you can refer fields with field names.&lt;/P&gt;&lt;P&gt;Look at existing feeds to get an idea.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Sep 2020 08:06:39 GMT</pubDate>
    <dc:creator>thambisetty</dc:creator>
    <dc:date>2020-09-18T08:06:39Z</dc:date>
    <item>
      <title>Question on shell script for linux</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520026#M9293</link>
      <description>&lt;P&gt;Hi Splunkers&lt;/P&gt;&lt;P&gt;I have a CSV download with URL threat intel which is a flat file with URLs listed, I will import these into the Splunk Enteprise Security App however I need to add more columns to the file to allow the import&lt;/P&gt;&lt;P&gt;Currently the file is flat showing just URLs as below&lt;/P&gt;&lt;P&gt;&lt;A href="https://testurl.com" target="_blank"&gt;https://testurl.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://testurl.com" target="_blank"&gt;https://testurl1.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://testurl.com" target="_blank"&gt;https://testurl2.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://testurl3.com" target="_blank"&gt;https://testurl3.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I need to add the columns as below and have the URLs land in column 4 (url) as shown below&lt;/P&gt;&lt;P&gt;description,http_referrer,http_user_agent,url,weight&lt;/P&gt;&lt;P&gt;More of a *nix question but if anyone can assist with how I might edit this CSV to add those columns would be great.&lt;/P&gt;&lt;P&gt;I download the file via a CRON job so I'll create another job to run the import script after the download&lt;/P&gt;&lt;P&gt;Any help appreciated&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 22:54:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520026#M9293</guid>
      <dc:creator>Splunkometry88</dc:creator>
      <dc:date>2020-09-16T22:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Question on shell script for linux</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520087#M9294</link>
      <description>&lt;P&gt;I advice you to index data and create lookup using the data and you can have field headers the way you want.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 09:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520087#M9294</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-17T09:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Question on shell script for linux</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520222#M9295</link>
      <description>&lt;P&gt;Thanks for the suggestion,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have progressed a little bit, as the file needs to be imported by Splunk ES i've done the below&amp;nbsp;to create a new CSV file with the correct delimiting fields and then import the records from a downloaded file&lt;/P&gt;&lt;P&gt;I’ve managed to get the python working to create the new CSV file and I’ve got the command right to read the file but I need to get this imported into the url field in the newly created file&lt;/P&gt;&lt;P&gt;The script below creates the file but I’m just printing to shell at the end where I should be importing the df = pd.read_csv command into the newly created CSV file in the field 'url'&lt;/P&gt;&lt;P&gt;I'm looking at using pandas&lt;/P&gt;&lt;P&gt;import csv import pandas as pd&lt;/P&gt;&lt;P&gt;with open('destinationfile.csv', 'wb') as csvfile: filewriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) filewriter.writerow(['description', 'http_referrer', 'http_user_agent', 'url', 'wei$&lt;/P&gt;&lt;P&gt;df = pd.read_csv (r'/filepath/sourcefile.csv)' print df&lt;/P&gt;&lt;P&gt;Have a think about this, maybe there’s an easier way to do it&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 23:01:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520222#M9295</guid>
      <dc:creator>Splunkometry88</dc:creator>
      <dc:date>2020-09-17T23:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Question on shell script for linux</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520226#M9296</link>
      <description>&lt;P&gt;Hi Splunkometry88,&lt;/P&gt;&lt;P&gt;Try the following.&lt;/P&gt;&lt;P&gt;Create a file with the following content:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
echo "description,http_referrer,http_user_agent,url,weight" &amp;gt; dest.csv
sed -E 's/(.*)/,,,\1,/' source.txt &amp;gt;&amp;gt; dest.csv&lt;/LI-CODE&gt;&lt;P&gt;Save it as create_csv.sh.&lt;BR /&gt;&lt;BR /&gt;Then make it executable:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;chmod 744 create_csv.sh&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Assuming&amp;nbsp; 'source.txt' has your list of URLs, issuing the command:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;./create_csv.sh&lt;/LI-CODE&gt;&lt;P&gt;will produce a file named "dest.csv" that looks like:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;description,http_referrer,http_user_agent,url,weight
,,,https://testurl.com,
,,,https://testurl1.com,
,,,https://testurl2.com,
,,,https://testurl3.com,&lt;/LI-CODE&gt;&lt;P&gt;Hope that is what you were seeking.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;-bd-&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 23:25:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520226#M9296</guid>
      <dc:creator>bdiego_splunk</dc:creator>
      <dc:date>2020-09-17T23:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Question on shell script for linux</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520265#M9297</link>
      <description>&lt;P&gt;if your API doesn't have auth then you can directly call API request from Splunk Enterprise security. you can refer fields with field names.&lt;/P&gt;&lt;P&gt;Look at existing feeds to get an idea.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 08:06:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Question-on-shell-script-for-linux/m-p/520265#M9297</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-18T08:06:39Z</dc:date>
    </item>
  </channel>
</rss>

