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. bzoj1878 [SDOI2009]HH的项链——树状数组

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1878 离线树状数组,巧妙的思路呢: 给每种项链记录一个最后出现的位置lst,根据项链最后出现 ...

  2. ChartCtrl源码剖析之——CChartAxis类

    CChartAxis类用来绘制波形控件的坐标轴,这个源码相对较复杂,当初阅读的时候耗费了不少精力来理解源码中的一些实现细节. CChartAxis类的头文件. #if !defined(AFX_CHA ...

  3. Python科学计算工具包

    import numpy as np # 创建一个Ndarray # 1. 从list对象中创建 # 2. 创建一个特定的数组,全1数组ones,随机数组random.randn,对角矩阵diag # ...

  4. .NET修改配置文件

    首先说明,本文参考了这个帖子http://www.cnblogs.com/henw/archive/2012/01/31/2333783.html,进行了一些补充 简要说来两种方法,一是把config ...

  5. jquery 3D云

    http://www.jq22.com/jquery-info1325 http://demo.jq22.com/jquery-cloud-141217202931 下载地址: http://www. ...

  6. 设置Google搜索在新的标签页打开

    Google搜索的结果,默认情况下点击进入是在本标签页打开的,这样就很麻烦, 可以在搜索结果的页面中进行设置,让它在新的标签页显示 搜索结果设置->搜索设置->新的标签页打开

  7. Neighbor House LightOJ - 1047

    Neighbor House LightOJ - 1047 #include<cstdio> #include<cstring> #include<algorithm&g ...

  8. Sqlite数据库中索引的使用、索引的优缺点[转]

    原文链接1   原文链接2 3. 索引的种类 1)聚集索引:表中行的物理顺序与键值的逻辑(索引)顺序相同.因为数据的物理顺序只能有一种,所以一张表只能有一个聚集索引.如果一张表没有聚集索引,那么这张表 ...

  9. Java_JDBC连接数据库

    package com.accp.dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Pre ...

  10. .NET框架概述

    .NET战略目标: 任何时候(when),任何地方(where),使用任何工具(what)都能通过.NET的服务获得网络上的任何信息. .NET优势: 1.提供了一个面向对象的编程环境,完全支持面向对 ...