I also had this problem. This answer directly from a Slack conversation with @micahkemp , who wouldn't let me give him the karma for it.
tl;dr: the main fix is this:
def prepare(self):
self.configuration.required_fields = [self.source_field]
here's the full example, for context.
from splunklib.searchcommands import dispatch, Configuration, Option
from splunklib.searchcommands import StreamingCommand
@Configuration(distributed=False)
class TestRequiredFieldsCommand(StreamingCommand):
source_field = Option(require=True)
dest_field = Option(require=True)
def prepare(self):
self.configuration.required_fields = [self.source_field]
def stream(self, records):
for record in records:
record[self.dest_field] = record[self.source_field]
yield record
dispatch(TestRequiredFieldsCommand, module_name=__name__)
... View more