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+?) ...
随机推荐
- repo+manifests+git方式管理安卓代码
repo+manifests+git方式管理安卓代码 1.repo的获取 repo只是google用Python脚本写的调用git的一个脚本,主要是用来下载.管理Android项目的软件仓库.(也就是 ...
- Ubuntu midi 播放
One of the simplest methods to play a midi file in Ubuntu is to install timidity. sudo apt-get insta ...
- javascript 中==与===
1.==相等运算符 1.1如果操作数具有相同的类型,则判断其等同性,如果两个数的值相等,则返回true(相等),否则返回 false (不相等) 1.2如果两个操作数类型不同,则按如下规则: null ...
- OSI模型与TCP/IP模型基础
一.OSI七层模型 OSI(Open System Interconnection),OSI是一个开放性的通行系统互连参考模型,是一个协议规范.OSI七层模型是一种框架性的设计方法 ,建立七层模型的主 ...
- JS计算字符串实际长度
http://www.qttc.net/201207136.html // UTF8字符集实际长度计算 function getStrLeng(str){ var realLength = 0; va ...
- Extjs 3 TreePanel相关操作
这里说的选中是指鼠标点击一个节点后,节点那一行出现浅蓝色背景的选中,而非checkbox的勾选 方法 Ext.tree.TreePanel.getSelectionModel().getSelecte ...
- Linux Gcc编译错误(转载)
转自:http://www.linuxidc.com/Linux/2012-01/52153.htm Linux系统下的c编程与Windows有所不同,如果你在用gcc编译代码的时候提示‘for’ l ...
- bzoj2131: 免费的馅饼(树状数组)
Description Input 第一行是用空格隔开的二个正整数,分别给出了舞台的宽度W(1到10^8之间)和馅饼的个数n(1到10^5). 接下来n行,每一行给出了一块馅饼的信息.由三个正整数组成 ...
- spring/spring boot/spring cloud书籍推荐
最近看了一些spring书籍,主要都是工作需要,实话说,没有必要买这么多书,每个主题一本就足够了,其他的补充可以通过项目实战和上网看官网或者博客补充. 说是推荐,其实只是一些简单读后感想而已,每本书都 ...
- ACMer需要的 java基本知识
1.基本定义 import java.util.*; import java.io.*; public class Main { public static void main(String[] ar ...