#NEWLINE# def process( self , args = argv , input_file = stdin , output_file = stdout ) : #NEWLINE# #INDENT# ' Processes search results as specified by command arguments.\n\n        :param args: Sequence of command arguments\n        :param input_file: Pipeline input file\n        :param output_file: Pipeline output file\n\n        ' #NEWLINE# self . logger . debug ( ( '%s arguments: %s' % ( type ( self ) . __name__ , args ) ) ) #NEWLINE# self . _configuration = None #NEWLINE# if ( ( len ( args ) >= 2 ) and ( args [ 1 ] == '__GETINFO__' ) ) : #NEWLINE# #INDENT# ( ConfigurationSettings , operation , args , reader ) = self . _prepare ( args , input_file = None ) #NEWLINE# try : #NEWLINE# #INDENT# self . parser . parse ( args , self ) #NEWLINE# #UNINDENT# except ( SyntaxError , ValueError ) as e : #NEWLINE# #INDENT# writer = csv . DictWriter ( output_file , self , fieldnames = [ 'ERROR' ] ) #NEWLINE# writer . writerow ( { #NEWLINE# #INDENT# 'ERROR' : e , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . logger . error ( e ) #NEWLINE# return #NEWLINE# #UNINDENT# self . _configuration = ConfigurationSettings ( self ) #NEWLINE# writer = csv . DictWriter ( output_file , self , self . configuration . keys ( ) , mv_delimiter = ',' ) #NEWLINE# writer . writerow ( self . configuration . items ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( len ( args ) >= 2 ) and ( args [ 1 ] == '__EXECUTE__' ) ) : #NEWLINE# #INDENT# self . input_header . read ( input_file ) #NEWLINE# ( ConfigurationSettings , operation , args , reader ) = self . _prepare ( args , input_file ) #NEWLINE# try : #NEWLINE# #INDENT# self . parser . parse ( args , self ) #NEWLINE# #UNINDENT# except ( SyntaxError , ValueError ) as e : #NEWLINE# #INDENT# from sys import exit #NEWLINE# self . messages . append ( 'error_message' , e ) #NEWLINE# self . messages . write ( output_file ) #NEWLINE# self . logger . error ( e ) #NEWLINE# exit ( 1 ) #NEWLINE# #UNINDENT# self . _configuration = ConfigurationSettings ( self ) #NEWLINE# if self . show_configuration : #NEWLINE# #INDENT# self . messages . append ( 'info_message' , ( '%s command configuration settings: %s' % ( self . name , self . _configuration ) ) ) #NEWLINE# #UNINDENT# writer = csv . DictWriter ( output_file , self ) #NEWLINE# self . _execute ( operation , reader , writer ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# file_name = path . basename ( args [ 0 ] ) #NEWLINE# message = 'Command {0} appears to be statically configured and static configuration is unsupported by splunklib.searchcommands. Please ensure that default/commands.conf contains this stanza: [{0}] | filename = {1} | supports_getinfo = true | supports_rawargs = true | outputheader = true' . format ( type ( self ) . name , file_name ) #NEWLINE# self . messages . append ( 'error_message' , message ) #NEWLINE# self . messages . write ( output_file ) #NEWLINE# self . logger . error ( message )