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的更多相关文章

  1. splunk + docker-compose 实现自定义 index

    splunk是一款非常优秀的运维管理平台.Splunk 是机器数据的引擎.使用 Splunk 可收集.索引和利用所有应用程序.服务器和设备生成的快速移动型计算机数据 . 使用 Splunking 处理 ...

  2. 【SaltStack官方版】—— returners——返回器

    ETURNERS 返回器 By default the return values of the commands sent to the Salt minions are returned to t ...

  3. splunk 索引过程

    术语: Event :Events are records of activity in log files, stored in Splunk indexes. 简单说,处理的日志或话单中中一行记录 ...

  4. splunk rest api search

    如下: curl -u admin:changeme -k https://localhost:8089/services/search/jobs -d search="search sou ...

  5. 大数据工具——Splunk

    Splunk是机器数据的引擎.使用 Splunk 可收集.索引和利用所有应用程序.服务器和设备(物理.虚拟和云中)生成的快速移动型计算机数据 .从一个位置搜索并分析所有实时和历史数据. 使用 Splu ...

  6. 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- ...

  7. Awesome Big Data List

    https://github.com/onurakpolat/awesome-bigdata A curated list of awesome big data frameworks, resour ...

  8. 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 ...

  9. Splunk 简单笔记

    Splunk Notes source="c:\logs\abc.log" | rex field=url "(?<=\/)(?<ApiId>\w+?) ...

随机推荐

  1. hdu 1480

    钥匙计数之二 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  2. hdu 1348【凸包模板】

    #include<iostream> #include<iostream> #include<algorithm> #include<cmath> us ...

  3. (博弈论 高精度小数)51NOD 1185 威佐夫游戏 V2

    有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取相同数量的石子,但不可不取.拿到最后1颗石子的人获胜.假设A B都非常聪明,拿石子的过程中不会出现失误.给出2堆石子的数量, ...

  4. PhpStorm Xdebug远程调试环境搭建原理分析及问题排查

    2017年05月26日  经验心得 目录   一. 环境介绍 二. 远程环境配置 2.2 Xdebug安装 2.3 配置 三. 本地phpstorm配置 3.1 下载远程代码 3.2 添加php解释器 ...

  5. _bzoj1009 [HNOI2008]GT考试【矩阵加速dp】

    传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1009 比较不错的一道题,令f(i, j)表示考号匹配到i位,后j位为不吉利串的前j位,那么对 ...

  6. String Mark Codeforces - 895D

    一看好像会做的样子,就去做了一下,结果 猝不及防地T掉了 赶紧查了一下,没有死循环,复杂度也是对的,无果,于是翻了题解 题解没看懂,但是找到了标程,然后发现我被卡常了... 而且好像当时还过了前10个 ...

  7. 题解报告:poj 2299 Ultra-QuickSort(BIT求逆序数)

    Description In this problem, you have to analyze a particular sorting algorithm. The algorithm proce ...

  8. ACM_平面、空间分割问题(递推dp)

    折线分割平面 Time Limit: 2000/1000ms (Java/Others) Problem Description: 我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要 ...

  9. 动态链接库(DLL) 分类: c/c++ 2015-01-04 23:30 423人阅读 评论(0) 收藏

    动态链接库:我们经常把常用的代码制作成一个可执行模块供其他可执行文件调用,这样的模块称为链接库,分为动态链接库和静态链接库. 对于静态链接库,LIB包含具体实现代码且会被包含进EXE中,导致文件过大, ...

  10. 获取select里面option所有的值

    1.HTML结构 <select id="test"> <option value="option-1">option-1</op ...