[![Build Status](https://travis-ci.org/ryancurrah/searchsplunk.svg?branch=master)](https://travis-ci.org/ryancurrah/searchsplunk) [![Coverage Status](https://coveralls.io/repos/github/ryancurrah/searchsplunk/badge.svg?branch=master)](https://coveralls.io/github/ryancurrah/searchsplunk?branch=master)
# Search Splunk
Easily create Splunk searches from Python and get the result as a Python object
# Requires
- requests>=2.7.0: https://pypi.python.org/pypi/requests
# Installation instructions
[Searchsplunk](https://pypi.python.org/pypi/searchsplunk) can be installed from PyPi.
```bash
pip install searchsplunk
```
# Usage instructions
```python
from searchsplunk.searchsplunk import SearchSplunk
s = SearchSplunk('https://splunk.acme.com:8089', 'MYUSER', 'MYPASS', ssl_verify=True)
result = s.search('sourcetype=salt:grains openstack_uid=e0303456c-d5a3-789f-ab68-8f27561ffa0f | dedup openstack_uid')
import json
print json.dumps(result, sort_keys=True, indent=2)
{
"fields": [
{
"name": "_bkt"
},
{
"name": "_cd"
},
{
"name": "_indextime"
},
{
"name": "_kv"
},
{
"name": "_raw"
},
{
"name": "_serial"
},
{
"name": "_si"
},
{
"name": "_sourcetype"
},
{
"name": "_subsecond"
},
{
"name": "_time"
},
{
"name": "host"
},
{
"name": "index"
},
{
"name": "linecount"
},
{
"name": "openstack_uid"
},
{
"name": "source"
},
{
"name": "sourcetype"
},
{
"name": "splunk_server"
}
],
"init_offset": 0,
"messages": [],
"preview": false,
"results": [
{
"_bkt": "main~1122~25B521A6-9612-407D-A1BA-F8KJSEBB7628",
"_cd": "1122:290410720",
"_indextime": "1435071966",
"_kv": "1",
"_raw": "somefile contents",
"_serial": "0",
"_si": [
"splunkserv",
"main"
],
"_sourcetype": "salt:grains",
"_time": "2015-06-23T11:06:05.000-04:00",
"host": "server-7654.acme.com",
"index": "main",
"linecount": "17",
"openstack_uid": "e0303456c-d5a3-789f-ab68-8f27561ffa0f",
"source": "/etc/salt/grains",
"sourcetype": "salt:grains",
"splunk_server": "splunkmaster"
}
]
}
```
## Contributors
- [pkeeper](https://github.com/pkeeper)
- [lowell80](https://github.com/lowell80)
## Author
[Ryan Currah](ryan@currah.ca)
## License
GPL v2
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
搜索Splunk 从Python轻松创建Splunk搜索并将结果作为Python对象获取 需要 请求> = 2.7.0: : 安装说明 可以从PyPi安装 。 pip install searchsplunk 使用说明 from searchsplunk . searchsplunk import SearchSplunk s = SearchSplunk ( 'https://splunk.acme.com:8089' , 'MYUSER' , 'MYPASS' , ssl_verify = True ) result = s . search ( 'sourcetype=salt:grains openstack_uid=e0303456c-d5a3-789f-ab68-8f27561ffa0f | dedup openstack_uid' ) import json pri
资源详情
资源评论
资源推荐
收起资源包目录
searchsplunk-master.zip (17个子文件)
searchsplunk-master
.coveralls.yml 24B
test-requirements.txt 74B
searchsplunk
exceptions.py 130B
searchsplunk.py 5KB
__init__.py 0B
tests
test_searchsplunk.py 4KB
version.py 64B
requirements.txt 16B
run_tests.sh 223B
.travis.yml 368B
LICENSE 18KB
run_build.sh 443B
setup.cfg 178B
setup.py 1KB
README.md 2KB
.gitignore 61B
CHANGELOG.md 698B
共 17 条
- 1
火君
- 粉丝: 24
- 资源: 4608
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0