Skip to content

Commit

Permalink
stackoverflow version
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptingislife committed Feb 5, 2020
1 parent 3ebf9f6 commit 440c7bc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/logging_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ def get_secret():
secret_name = 'LogDNAIngestionKey' # os.environ['LOGGING_KEY']
region_name = "us-east-1"


secrets_client = boto3.client('secretsmanager')
secret_arn = "arn:aws:secretsmanager:us-east-1:358663747217:secret:LogDNAIngestionKey-HEKYmj"
auth_token = secrets_client.get_secret_value(SecretId=secret_arn).get('logdna-ingestion')

return auth_token


# Create a Secrets Manager client
session = boto3.session.Session()
client = session.client(
Expand Down Expand Up @@ -89,7 +97,7 @@ def log_scan(db_data):

h_data = {"Content-Type": "application/json; charset=UTF-8"}

submission = requests.post('https://logs.logdna.com/logs/ingest?hostname=GLIMPSE', json=logdata, headers=h_data, auth=HTTPBasicAuth(logdna['logdna-ingestion'], ''))
submission = requests.post('https://logs.logdna.com/logs/ingest?hostname=GLIMPSE', json=logdata, headers=h_data, auth=HTTPBasicAuth(logdna, ''))

if submission.status_code != 200: # or submission.json['status'] != "ok":
raise ValueError('Got status {}'.format(submission.status_code))

0 comments on commit 440c7bc

Please sign in to comment.