我可以从 one_shot 查询中获得结果,但我无法获得 _raw 字段的全部内容。
import splunklib.client as client
import splunklib.results as results
def splunk_oneshot(search_string, **CARGS):
# Run a oneshot search and display the results using the results reader
service = client.connect(**CARGS)
oneshotsearch_results = service.jobs.oneshot(search_string)
# Get the results and display them using the ResultsReader
reader = results.ResultsReader(oneshotsearch_results)
for item in reader:
for key in item.keys():
print(key, len(item[key]), item[key])
这为我提供了 _raw 的以下信息:
('_raw', 120, '2013-05-03 22:17:18,497+0000 [SWF Activity attNsgActivitiesTaskList1 19] INFO c.s.r.h.s.a.n.AttNsgSmsRequestAdapter - ')
因此,此内容被截断为 120 个字符。我需要搜索结果的全部值,因为我需要对其进行一些字符串比较。我没有找到有关 ResultsReader 字段或其大小限制的任何文档。