<?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: Custom command not running sequentially in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692399#M11570</link>
    <description>&lt;P&gt;The custom command is to write the output of the normal query which it is preceding which will give me a table will nearly 1000-2000 rows to a csv file with a custom location and custom file name, basically my query will look something like the below one&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=your_index sourcetype=your_sourcetype&lt;/P&gt;&lt;P&gt;| search your_search_conditions | lookup your_lookup_table OUTPUTNEW additional_fields&lt;/P&gt;&lt;P&gt;| eval new_field = if(isnull(old_field), "default_value", old_field)&lt;/P&gt;&lt;P&gt;| table required_fields | exportcsv {file_path} {filename}&lt;/P&gt;&lt;P&gt;in which exportcsv is my custom command and my commands.conf file looks like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[exportcsv] filename = exportcsv.py&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jul 2024 10:43:05 GMT</pubDate>
    <dc:creator>Karthik_si_0107</dc:creator>
    <dc:date>2024-07-04T10:43:05Z</dc:date>
    <item>
      <title>Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692392#M11567</link>
      <description>&lt;P&gt;I have created a custom search command and i am doing a pipeline to a another spl query with my custom query for small size data's its working fine but when the data produced by the preceding query my custom query starts running and giving me incomplete data and i have only mentioned filename attribute in the commands.conf file of my custom&amp;nbsp; command will this be the reason&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 09:30:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692392#M11567</guid>
      <dc:creator>Karthik_si_0107</dc:creator>
      <dc:date>2024-07-04T09:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692393#M11568</link>
      <description>&lt;P&gt;What custom command type are you using? Are you accepting chunked data?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 09:37:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692393#M11568</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-04T09:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692398#M11569</link>
      <description>&lt;P&gt;I dont think its a chunked data&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 10:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692398#M11569</guid>
      <dc:creator>Karthik_si_0107</dc:creator>
      <dc:date>2024-07-04T10:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692399#M11570</link>
      <description>&lt;P&gt;The custom command is to write the output of the normal query which it is preceding which will give me a table will nearly 1000-2000 rows to a csv file with a custom location and custom file name, basically my query will look something like the below one&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=your_index sourcetype=your_sourcetype&lt;/P&gt;&lt;P&gt;| search your_search_conditions | lookup your_lookup_table OUTPUTNEW additional_fields&lt;/P&gt;&lt;P&gt;| eval new_field = if(isnull(old_field), "default_value", old_field)&lt;/P&gt;&lt;P&gt;| table required_fields | exportcsv {file_path} {filename}&lt;/P&gt;&lt;P&gt;in which exportcsv is my custom command and my commands.conf file looks like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[exportcsv] filename = exportcsv.py&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 10:43:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692399#M11570</guid>
      <dc:creator>Karthik_si_0107</dc:creator>
      <dc:date>2024-07-04T10:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692401#M11571</link>
      <description>&lt;P&gt;What class is your command (from your python source)?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 10:47:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692401#M11571</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-04T10:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692403#M11572</link>
      <description>&lt;P&gt;this is my script, sorry i am new to splunk, so not aware what exactly you are asking&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import csv&lt;BR /&gt;import os&lt;BR /&gt;import sys&lt;/P&gt;&lt;P&gt;def exportcsv():&lt;BR /&gt;try:&lt;BR /&gt;if len(sys.argv) &amp;lt; 3:&lt;BR /&gt;sys.exit(1)&lt;/P&gt;&lt;P&gt;release = sys.argv[1]&lt;BR /&gt;foldername = sys.argv[2]&lt;BR /&gt;&lt;BR /&gt;os.makedirs(folder_path, exist_ok=True)&lt;/P&gt;&lt;P&gt;input_data = sys.stdin.read()&lt;/P&gt;&lt;P&gt;rows = input_data.strip().split('\n')&lt;BR /&gt;header = rows[0].split(',')&lt;BR /&gt;data = [row.split(',') for row in rows[1:]]&lt;/P&gt;&lt;P&gt;filepath = os.path.join(folder_path, filename)&lt;BR /&gt;print(f"Writing to file: {filepath}", file=sys.stderr)&lt;BR /&gt;with open(filepath, 'w', newline='') as file:&lt;BR /&gt;writer = csv.writer(file)&lt;BR /&gt;writer.writerow(header)&lt;BR /&gt;writer.writerows(data)&lt;BR /&gt;print("Status")&lt;BR /&gt;print("Export Successful to " + filepath)&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"Error: {e}", file=sys.stderr)&lt;BR /&gt;sys.exit(1)&lt;/P&gt;&lt;P&gt;if __name__ == "__main__":&lt;BR /&gt;exportcsv()&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 10:53:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692403#M11572</guid>
      <dc:creator>Karthik_si_0107</dc:creator>
      <dc:date>2024-07-04T10:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692404#M11573</link>
      <description>&lt;P&gt;I am not specifically using any class type i just read the data from my&amp;nbsp;stdin and writting directly to my csv&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 11:06:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692404#M11573</guid>
      <dc:creator>Karthik_si_0107</dc:creator>
      <dc:date>2024-07-04T11:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692405#M11574</link>
      <description>&lt;P&gt;My guess is that your custom command is getting the first chunk and stopping? Or perhaps your script is being called multiple times and you are perhaps overwriting the csv?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 12:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692405#M11574</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-04T12:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692407#M11575</link>
      <description>&lt;P&gt;It would be helpful if you could suggest a way to overcome this if that's the case&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 12:58:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692407#M11575</guid>
      <dc:creator>Karthik_si_0107</dc:creator>
      <dc:date>2024-07-04T12:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692415#M11576</link>
      <description>&lt;P&gt;Try implementing using the class model&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 14:14:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692415#M11576</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-04T14:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692419#M11577</link>
      <description>&lt;P&gt;when i try to install splunklib i am getting a error because of pycrypto ....so couldn't follow that&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 14:49:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692419#M11577</guid>
      <dc:creator>Karthik_si_0107</dc:creator>
      <dc:date>2024-07-04T14:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692549#M11578</link>
      <description>&lt;P&gt;That's a bit more complicated than that.&lt;/P&gt;&lt;P&gt;See &lt;A href="https://dev.splunk.com/enterprise/docs/devtools/customsearchcommands/" target="_blank"&gt;https://dev.splunk.com/enterprise/docs/devtools/customsearchcommands/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jul 2024 11:55:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692549#M11578</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-07-06T11:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Custom command not running sequentially</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692593#M11581</link>
      <description>&lt;P&gt;I could see we need to use splunklib library in custom command creation but when i try to install the library i am getting a exception due to its dependency download which is pycrypto which i understood is not supported in splunk version 9.x, is there a alternate way to do it.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 05:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Custom-command-not-running-sequentially/m-p/692593#M11581</guid>
      <dc:creator>Karthik_si_0107</dc:creator>
      <dc:date>2024-07-08T05:56:53Z</dc:date>
    </item>
  </channel>
</rss>

