parser.add_option('-i', '--infinite', dest="infinite", action="store_true", help="When no files are provided," "es_import will read from stdin. Infinite avoids es_import to stop if not input occured within 5 secondes.") (options, args) = parser.parse_args() if options.files is None and options.fifo is None: parser.print_help() sys.exit(-1) if options.files is not None and options.fifo is not None: print "FIFO and file read are exclusive." sys.exit(-1) injector = ESInject("localhost:9200", "nxapi") parser = NxParser() parser.out_date_format = "%Y-%m-%dT%H:%M:%SZ" geoloc = NxGeoLoc() if options.files is not None and options.files == "": if options.infinite is True: #print "reading from stdin (infinite)" reader = NxReader(macquire, lglob=[], stdin=True, stdin_timeout=None) else: #print "reading from stdin (with timeout)" reader = NxReader(macquire, lglob=[], stdin=True) reader.read_files() elif options.files is not None and len(options.files) > 0: #print "reading from files !"+options.files+"!" reader = NxReader(macquire, lglob=[options.files]) reader.read_files() elif options.fifo is not None: fd = open_fifo(options.fifo)