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. sharepoint2013安装AppFabric出错

    手动安装AppFabric "d:\WindowsServerAppFabricSetup_x64.exe" /i CacheClient,CachingService,Cache ...

  2. 【转载】OAuth的机制原理讲解及开发流程

    1.OAuth的简述 OAuth(Open Authorization,开放授权)是为用户资源的授权定义了一个安全.开放及简单的标准,第三方无需知道用户的账号及密码,就可获取到用户的授权信息,并且这是 ...

  3. 安装MySQL需要注意的事项

    一.安装MySQL之后,怎样启动MySQL,以及登录.查看数据库操作? 用管理员身份运行cmd或power shell 二.当然有可能会出现不能在cmd或power shell中登录数据库账户 造成这 ...

  4. sql server 改sa 密码

      ALTER LOGIN sa ENABLE ; ALTER LOGIN sa WITH PASSWORD = 'kongwenyi' ;

  5. NOIp2013 货车运输 By cellur925

    题目传送门 A 国有 n 座城市,编号从 1 到 n ,城市之间有 m 条双向道路.每一条道路对车辆都有重量限制,简称限重. 现在有 q 辆货车在运输货物, 司机们想知道每辆车在不超过车辆限重的情况下 ...

  6. ios手机Safari本地服务连不上

    问题: 今天在本地起服务准备测下ios手机端页面,结果发现:页面可以打开,但是登录不上. 用alert定位了下,await fn() 报错被try()catch(){}捕获了... 原因: 该机子不支 ...

  7. JSON WEB TOKEN 从原理到实战

    阅读本文大概需要 4.2 分钟. 作者:王廷骏原文:https://juejin.im/post/5ce272c1e51d45109b01b0f8 1. JSON WEB TOKEN 1.1 什么是J ...

  8. JAVA大数处理(BigInteger,BigDecimal)

    原文链接 Java中有两个类BigInteger和BigDecimal分别表示大整数类和大浮点数类. 这两个类都在java.math.*包中,因此每次必须在开头处引用该包. Ⅰ基本函数: 1.valu ...

  9. JAVA中abstract,interface,final,static语法

    转自:http://www.cnblogs.com/yueue/archive/2010/04/20/1715863.html 一,抽象类:abstract     1,只要有一个或一个以上抽象方法的 ...

  10. java使用正则表达式对注册页面进行验证

    package regex; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Patt ...