Beispiel #1
0
class EventgenDependency(DependencyProvider):

    arguments = create_args()
    eventgen = eventgen_core.EventGenerator(arguments)
    log = logging.getLogger('eventgen_dependency')
    log.info(
        "EventgenDependency Init. Memory reference to eventgen object: {}".
        format(eventgen))

    configured = False
    configfile = 'N/A'

    if os.path.isfile(CUSTOM_CONFIG_PATH):
        configured = True
        configfile = CUSTOM_CONFIG_PATH
        eventgen.reload_conf(CUSTOM_CONFIG_PATH)

    def get_dependency(self, worker_ctx):
        return self

    def refresh_eventgen(self):
        self.eventgen = eventgen_core.EventGenerator(self.arguments)
        self.configured = False
        self.configfile = 'N/A'
        self.log.info("Refreshed Eventgen Object: {}".format(self.eventgen))
Beispiel #2
0
def main():
    cwd = os.getcwd()
    args = parse_args()
    if args.subcommand == "generate":
        eventgen = eventgen_core.EventGenerator(args=args)
        eventgen.start()
    elif args.subcommand == "service":
        run_nameko(args)
    elif args.subcommand == "build":
        if not args.destination:
            args.destination = cwd
        build_splunk_app(dest=args.destination, remove=args.remove)
    sys.exit(0)
Beispiel #3
0
def main():
    cwd = os.getcwd()
    args = parse_args()
    args.verbosity = convert_verbosity_count_to_logging_level(args.verbosity)
    if args.subcommand == "generate":
        eventgen = eventgen_core.EventGenerator(args=args)
        eventgen.start()
    elif args.subcommand == "service":
        env_vars = gather_env_vars(args)
        if args.role == "controller":
            from eventgen_api_server.eventgen_controller import EventgenController
            EventgenController(env_vars=env_vars).app_run()
        elif args.role == "server":
            from eventgen_api_server.eventgen_server import EventgenServer
            EventgenServer(env_vars=env_vars, mode="cluster").app_run()
        elif args.role == "standalone":
            from eventgen_api_server.eventgen_server import EventgenServer
            EventgenServer(env_vars=env_vars, mode="standalone").app_run()
    elif args.subcommand == "build":
        if not args.destination:
            args.destination = cwd
        build_splunk_app(dest=args.destination, remove=args.remove)
    sys.exit(0)
Beispiel #4
0
 def refresh_eventgen(self):
     self.eventgen = eventgen_core.EventGenerator(self.arguments)
     self.configured = False
     self.configfile = 'N/A'
     self.log.info("Refreshed Eventgen Object: {}".format(self.eventgen))