diff --git a/parsedmarc/cli.py b/parsedmarc/cli.py index b37484b..75ce8de 100644 --- a/parsedmarc/cli.py +++ b/parsedmarc/cli.py @@ -164,21 +164,17 @@ def _main(): if args.elasticsearch_host: elastic.set_hosts(args.elasticsearch_host) elastic.create_indexes() - if args.hec: - if args.hec_token is None or args.hec_index is None: - logger.error("HEC token and HEC index are required when " - "using HEC URL") - exit(1) - hec_client = splunk.HECClient(args.hec, args.hec_token, - index=args.hec_index) except ElasticsearchException as error: logger.error("Elasticsearch Error: {0}".format(error.__str__())) exit(1) if args.hec: - if args.hec_key is None: - logger.error("HEC URL provided without HEC key") + if args.hec_token is None or args.hec_index is None: + logger.error("HEC token and HEC index are required when " + "using HEC URL") exit(1) + hec_client = splunk.HECClient(args.hec, args.hec_token, + args.hec_index) file_paths = [] for file_path in args.file_path: