Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Reverts edit made to the check for the details.requestparameters.html…
Browse files Browse the repository at this point in the history
…part (#1662)

* truncates htmlpart to something ES can handle

* adding comments to code and checking if values exist per @arcrose's suggestion

* removing whitespace

* adds a constnat and adds description for the ES_FIELD_LIMIT_VALUE constant.

* reverting check for details.requestparameters.htmlpart edit

* fixing whitespace

* fixing whitespace
  • Loading branch information
Phrozyn committed Jul 20, 2020
1 parent d1b66ec commit 8350ebc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mq/plugins/cloudtrail.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ def onMessage(self, message, metadata):
so we'll truncate it to 4096 characters using the constant ES_FIELD_VALUE_LIMIT so that ES will ingest it,
leaving us with knowledge of what the field contains without the overkill of storing the entire page.
'''

ES_FIELD_VALUE_LIMIT = 4095
if message.get('details', {}).get('requestparameters', {}).get('htmlpart') is not None:

if 'requestparameters' in message['details']:
if 'htmlpart' in message['details']['requestparameters']:
message['details']['requestparameters']['htmlpart'] = message['details']['requestparameters']['htmlpart'][0:ES_FIELD_VALUE_LIMIT]

for modified_key in self.modify_keys:
Expand Down

0 comments on commit 8350ebc

Please sign in to comment.