Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit b48043c

Browse files
committed
[run_test.py] Add --verbose parameter to debug ES responses
1 parent 6665ab1 commit b48043c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Alerting/Sample Watches/run_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import json
1010
import yaml
1111
import subprocess
12+
import logging
1213

1314
from elasticsearch import Elasticsearch
1415
from elasticsearch.client import XPackClient
@@ -27,6 +28,7 @@ def load_file(serialized_file):
2728
import argparse
2829

2930
parser = argparse.ArgumentParser(description='Index Connection Log data into ES with the last event at the current time')
31+
parser.add_argument('-v', '--verbose', help='verbose output', action='store_true')
3032
parser.add_argument('--host', help='host name')
3133
parser.add_argument('--port', help='port')
3234
parser.add_argument('--user', help='user')
@@ -56,6 +58,10 @@ def load_file(serialized_file):
5658

5759
parser.set_defaults(host='localhost', port="9200", protocol="http", test_file='data.json', user='elastic', password='changeme')
5860
args = parser.parse_args()
61+
62+
if args.verbose:
63+
logging.basicConfig(level=logging.DEBUG)
64+
5965
es = Elasticsearch([args.protocol+"://"+args.host+":"+args.port], http_auth=(args.user, args.password), ca_certs=args.cacert)
6066

6167
test = load_file(args.test_file)

0 commit comments

Comments
 (0)