Skip to content

Commit

Permalink
remove DisableJSON from forwarder template
Browse files Browse the repository at this point in the history
  • Loading branch information
SollyzDev committed Jul 16, 2024
1 parent 9d5e751 commit b50ac88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
7 changes: 0 additions & 7 deletions cloudformation-stacks/forwarder.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ Parameters:
DataTags:
Type: String
Description: Tags to be included with the data ingested into axiom. e.g. <key1>=<value1>,<key2>=<value2>.
DisableJSON:
Type: String
AllowedValues:
- true
- false
Default: false
Description: Whether or not disable json logs. defaults to false.
Conditions:
HasCloudWatchLogGroupNames: !Not
- !Equals
Expand Down
7 changes: 3 additions & 4 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
axiom_url = os.getenv("AXIOM_URL", "https://api.axiom.co").strip("/")
axiom_token = os.getenv("AXIOM_TOKEN")
axiom_dataset = os.getenv("AXIOM_DATASET")
disable_json = os.getenv("DISABLE_JSON", "false") == "true"
data_tags_string = os.getenv("DATA_TAGS")
data_service_name = os.getenv("DATA_MESSAGE_KEY")

Expand Down Expand Up @@ -182,14 +181,14 @@ def lambda_handler(event: dict, context=None):

lambda_data = None
json_data = None
if not disable_json:
# Try to Parse message as json
if message.startswith("{") and message.endswith("}"):
# Try to Parse message as JSON
json_data = structured_message(message)
if json_data is not None:
# Data is parsed to JSON, so use it
lambda_data = json_data

# Parse json is not allowed or failed.
# Message is not JSON or parsing failed.
if json_data is None:
msg = parse_message(message)
if len(msg) != 0:
Expand Down

0 comments on commit b50ac88

Please sign in to comment.