Skip to content

Commit

Permalink
Merge pull request #2 from 3box/fix/did-is-now-optional
Browse files Browse the repository at this point in the history
did may not be logged now
  • Loading branch information
gvelez17 authored Jun 25, 2024
2 parents bf20fac + 97d16e4 commit 6d7a8fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion logs-to-tsdb/kinesis-lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def handler(event, context):
continue

log_data = json.loads(match.group(1))
batched.append((ts, log_data['cid'], log_data['did'], log_data.get('model'), log_data.get('family'), log_data.get('stream'), log_data.get('origin'), log_data.get('cacao'), log_data.get('cap_cid')))
cid = log_data.get('cid')
if not cid:
print("NO CID in data! {}".format(log_data))
continue
batched.append((ts, cid, log_data.get('did'), log_data.get('model'), log_data.get('family'), log_data.get('stream'), log_data.get('origin'), log_data.get('cacao'), log_data.get('cap_cid')))

# Insert logs into TimescaleDB
insert_query = "INSERT INTO cas_log_data (timestamp, cid, did, model, family, stream, origin, cacao, cap_cid) VALUES %s on CONFLICT DO NOTHING"
Expand Down

0 comments on commit 6d7a8fa

Please sign in to comment.