Skip to content

Commit

Permalink
Updating event writer
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMurphey committed Jan 23, 2020
1 parent f2a76a7 commit 0b26a07
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/bin/syndication_app/event_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
import time
import random
import re
from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path
from splunk.clilib.bundle_paths import make_splunkhome_path

try:
basestring
except:
basestring = str

# Python handles datetimes badly, really badly. Below is a UTC timezone implementation since
# Python does not include one by default
Expand Down Expand Up @@ -132,12 +137,6 @@ def event_to_string(self, result, event_time=None, ignore_empty_fields=True):
# Escape special fields that Splunk will overwrite
converted_key = self.convert_special_fields(key)

# Python 2+3 basestring
try:
basestring
except NameError:
basestring = str

# Do not include fields whose name is empty or none since this indicates that the field
# should not be included at all
if converted_key is None or len(converted_key) == 0:
Expand All @@ -154,7 +153,7 @@ def event_to_string(self, result, event_time=None, ignore_empty_fields=True):
result_value = str(result[key])

# If the field is blank then do not include it if we are supposed to exclude it
if result_value <= 0 and ignore_empty_fields == True:
if len(result_value) <= 0 and ignore_empty_fields == True:
pass # Ignore this field and continue to the next field value
else:
#TODO: need to figure out if field names must be escaped
Expand Down

0 comments on commit 0b26a07

Please sign in to comment.