One more question, I just want to out the value of fields, then send it. So which command should i create? (Streaming, Generating, Transforming or something else). Because I'm using Streaming and it return error: TypeError at "/opt/splunk/etc/apps/testCommand/bin/splunklib/searchcommands/internals.py", line 573 : 'NoneType' object is not iterable This is my command: from __future__ import absolute_import, division, print_function, unicode_literals
import os,sys
import time
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators
import requests
@Configuration()
class GenerateTextCommand(StreamingCommand):
def stream(self,records):
for record in records:
fields = self.fieldnames
i = record[fields[0]]
botURL = "https://api.telegram.org/botTOKEN/sendMessage?chat_id=CHAT_ID&text="+str(i)
r = requests.get(botURL)
dispatch(GenerateTextCommand, sys.argv, sys.stdin, sys.stdout, __name__)
... View more