get data from splunk
link:
http://dev.splunk.com/view/python-sdk/SP-CAAAER5
download SDK & setup with python
code:
import splunklib.client as client import splunklib.results as results import time
start = time.time()
HOST = "hostname"
PORT = 8089
USERNAME = "username"
PASSWORD = "password"
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)
kwargs_oneshot = {"earliest_time": "2017-07-01T12:00:00.000",
"latest_time": "2017-07-09T12:00:00.000",
"exec_mode": "blocking"} # ,'search_mode': 'normal'
searchquery_oneshot = "search index=networkname netlinename|table rowname"
search_results = service.jobs.create(searchquery_oneshot, **kwargs_oneshot)
# Get the results and display them using the ResultsReader
rr = search_results.results(**{'count': 0})
reader = results.ResultsReader(rr)
inbound = []
outbound = []
for item in reader:
_raw_list = str(item['_raw'])
# print _raw_list
inbound.append(_raw_list.split(",")[3])
outbound.append(_raw_list.split(",")[4])
# print inbound
# print outbound
print "inLen", len(inbound)
print "outLen", len(outbound)
print str(int(time.time() - start))
get data from splunk的更多相关文章
- splunk + docker-compose 实现自定义 index
splunk是一款非常优秀的运维管理平台.Splunk 是机器数据的引擎.使用 Splunk 可收集.索引和利用所有应用程序.服务器和设备生成的快速移动型计算机数据 . 使用 Splunking 处理 ...
- 【SaltStack官方版】—— returners——返回器
ETURNERS 返回器 By default the return values of the commands sent to the Salt minions are returned to t ...
- splunk 索引过程
术语: Event :Events are records of activity in log files, stored in Splunk indexes. 简单说,处理的日志或话单中中一行记录 ...
- splunk rest api search
如下: curl -u admin:changeme -k https://localhost:8089/services/search/jobs -d search="search sou ...
- 大数据工具——Splunk
Splunk是机器数据的引擎.使用 Splunk 可收集.索引和利用所有应用程序.服务器和设备(物理.虚拟和云中)生成的快速移动型计算机数据 .从一个位置搜索并分析所有实时和历史数据. 使用 Splu ...
- Loading Data into HDFS
How to use a PDI job to move a file into HDFS. Prerequisites In order to follow along with this how- ...
- Awesome Big Data List
https://github.com/onurakpolat/awesome-bigdata A curated list of awesome big data frameworks, resour ...
- Coursera, Big Data 3, Integration and Processing (week 1/2/3)
This is the 3rd course in big data specification courses. Data model reivew 1, data model 的特点: Struc ...
- Splunk 简单笔记
Splunk Notes source="c:\logs\abc.log" | rex field=url "(?<=\/)(?<ApiId>\w+?) ...
随机推荐
- AutoIT: 如何通过坐标相对位置来对无法识别的Menu以及GridView进行定位点击操作
一般情况下,GridView中的数据来自数据库,我们通过Windows Info,是无法获取GridView中的信息的.而软件定制的Menu,很多时候无法通过系统提供的WinMenuSelectIte ...
- Maven的-pl -am -amd参数学习
昨天maven的deploy任务需要只选择单个模块并且把它依赖的模块一起打包,第一时间便想到了-pl参数,然后就开始处理,但是因为之前只看了一下命令的介绍,竟然花了近半小时才完全跑通,故记录此文. 假 ...
- bzoj 1661: [Usaco2006 Nov]Big Square 巨大正方形【枚举】
每句两个顶点确定正方形,取max即可 #include<iostream> #include<cstdio> using namespace std; int n,x,y,s, ...
- P2210 Haywire(A*)
P2210 Haywire 题目描述 Farmer John有N只奶牛,(4 <= N <= 12,其中N是偶数). 他们建立了一套原生的系统,使得奶牛与他的朋友可以通过由干草保护的线路来 ...
- 超级实用的VSCode插件,帮你大幅提高工作效率
Visual Studio Code是一个轻量级但功能强大的源代码编辑器,可在桌面上运行,适用于Windows,macOS和Linux. 它内置了对JavaScript,TypeScript和Node ...
- 使用jquery进行跨域操作
ajax默认是不支持跨域操作的,只能提交跨域请求,无法获得响应.而可以用$.getScript()函数来进行跨域操作.代码如下: <button id="btnTest"&g ...
- Java中的流(5)大数据流的分段读取
来自文件 或 网络的InputStream数据量可能很大,如果用流的大小申请byte[],可能内存不足报错. 解决方案:分段读取 InputStream的方法int available()返回本次可读 ...
- css超出部分显示省略号
单行文本 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...
- NSSet转成NSArray 以及NSSortDescriptor的使用
//如果想排序以后再取,可以这样:NSSet *users = [groupUser users]; //如果是存的字典,则key后面写的是想按照哪个关键字进行排序 NSSortDescriptor ...
- 215 Kth Largest Element in an Array 数组中的第K个最大元素
在未排序的数组中找到第 k 个最大的元素.请注意,它是数组有序排列后的第 k 个最大元素,而不是第 k 个不同元素.例如,给出 [3,2,1,5,6,4] 和 k = 2,返回 5.注意事项:你可以假 ...