Skip to content

Commit

Permalink
Remove need for trailing slash on ES URL.
Browse files Browse the repository at this point in the history
  • Loading branch information
keithjjones committed May 3, 2022
1 parent 44148f9 commit 4188090
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
v0.3.4 Made datastream names consistent with ES expectations if -d is used without an index name.
v0.3.3 Added best compression option and fixed helper script.
v0.3.5 Removed need for trailing slash on ES URL.
v0.3.4 Made datastream names consistent with ES expectations if -d is used without an index name.
v0.3.3 Added best compression option and fixed helper script.
v0.3.2 Fixed a bug with a grep command.
v0.3.1 Added more logic to make ready for Elastic v8.
v0.3.0 Added filtering on keys. Cleaned up some argparse logic, breaking previous command lines.
Expand Down
8 changes: 4 additions & 4 deletions zeek2es.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ def senddatastream(args, es_index, mappings):
auth = HTTPBasicAuth(args['user'], args['passwd'])

lifecycle_policy = {"policy": {"phases": {"hot": {"actions": {"rollover": {"max_primary_shard_size": "{}GB".format(args['datastream'])}}}}}}
res = requests.put(args['esurl']+"_ilm/policy/zeek-lifecycle-policy", headers={'Content-Type': 'application/json'},
res = requests.put(args['esurl']+"/_ilm/policy/zeek-lifecycle-policy", headers={'Content-Type': 'application/json'},
data=json.dumps(lifecycle_policy).encode('UTF-8'), auth=auth, verify=False)
index_template = {"index_patterns": [es_index], "data_stream": {}, "composed_of": [], "priority": 500,
"template": {"settings": {"index.lifecycle.name": "zeek-lifecycle-policy"}, "mappings": mappings["mappings"]}}
if (args['compress']):
index_template["template"]["settings"]["index"] = {"codec": "best_compression"}
res = requests.put(args['esurl']+"_index_template/"+es_index, headers={'Content-Type': 'application/json'},
res = requests.put(args['esurl']+"/_index_template/"+es_index, headers={'Content-Type': 'application/json'},
data=json.dumps(index_template).encode('UTF-8'), auth=auth, verify=False)

# A function to send mappings to ES.
Expand All @@ -103,7 +103,7 @@ def sendmappings(args, es_index, mappings):
if (len(args['user']) > 0):
auth = HTTPBasicAuth(args['user'], args['passwd'])

res = requests.put(args['esurl']+es_index, headers={'Content-Type': 'application/json'},
res = requests.put(args['esurl']+"/"+es_index, headers={'Content-Type': 'application/json'},
data=json.dumps(mappings).encode('UTF-8'), auth=auth, verify=False)

# A function to send the ingest pipeline to ES.
Expand All @@ -113,7 +113,7 @@ def sendpipeline(args, ingest_pipeline):
if (len(args['user']) > 0):
auth = HTTPBasicAuth(args['user'], args['passwd'])

res = requests.put(args['esurl']+"_ingest/pipeline/zeekgeoip", headers={'Content-Type': 'application/json'},
res = requests.put(args['esurl']+"/_ingest/pipeline/zeekgeoip", headers={'Content-Type': 'application/json'},
data=json.dumps(ingest_pipeline).encode('UTF-8'), auth=auth, verify=False)

# Everything important is in here.
Expand Down

0 comments on commit 4188090

Please sign in to comment.