Try this:
import sys,re
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration
@Configuration()
class ExtractDicom(StreamingCommand):
def stream(self, records):
for record in records:
record['blah'] = None
record['meh'] = None
if "Attribute" in record['_raw']:
record['blah'] = "test"
else:
record['meh'] = "test2"
yield record
if __name__ == "__main__":
dispatch(ExtractDicom, sys.argv, sys.stdin, sys.stdout, __name__)
I ran into something incredibly similar, and the issue was that the first result returned from your custom search command dictates which fields will be handled by Splunk.
The solution is to set all of the possible fields to a default value every time, but most importantly the first time, you return a result.
... View more