Skip to main content

Async Splunk SDK

Project description

aiosplunk

An asyncio-based Python module for interacting with Splunk. Currently limited to only searches. Very much a work-in-progress.

Installation

pip install aiosplunk

Examples

Run a search and dump results out to a CSV file

import aiofiles

from aiosplunk import SplunkClient, Search
from aiosplunk.search import OutputMode

client = SplunkClient(host="localhost", username="user", password="pass")

search = Search(
    splunk_client=client,
    search_string="search index=_internal | head 500000",
    earliest="-4h",
    latest="now",
    output_mode=OutputMode.csv,
)

await search.run()
async with aiofiles.open("out.csv", "w") as f:
    lines = []
    async for line in s.get_results(fields=["_raw", "host"]):
        lines.append(str(line) + "\n")

    await f.writelines(lines)

Pull down results from an existing search and do something with the results

from aiosplunk import SplunkClient, Search
from aiosplunk.search import OutputMode

client = SplunkClient(host="localhost", username="user", password="pass")

search = await Search.from_sid(
    splunk_client=client, sid="1734103773.893674", output_mode=OutputMode.dict
)

lines = []
async for d in search.get_results(fields=["_raw", "host", "my_field"]):
    my_field = d.get("my_field")
    ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiosplunk-0.2.4.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiosplunk-0.2.4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file aiosplunk-0.2.4.tar.gz.

File metadata

  • Download URL: aiosplunk-0.2.4.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aiosplunk-0.2.4.tar.gz
Algorithm Hash digest
SHA256 9981a469dcb41d41cc55ec448c01c85f35050c585cfc6f0580b2fd8442432c0a
MD5 752861b3b7f67af95cb111bd0f4b2ea6
BLAKE2b-256 2c780ce7ad77c93b0ba021016fb3ddd701ec43cbf862b29e56777b808bab7771

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiosplunk-0.2.4.tar.gz:

Publisher: publish.yml on cschmidt0121/aiosplunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiosplunk-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: aiosplunk-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aiosplunk-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eca0f5000fb5df3429d88a4face963704bb234c604e49a4ab9f2f08e82d8ea3d
MD5 8a05a52920e332374868b216eeb5e05d
BLAKE2b-256 72a318dec08ec87d739d83ea2ebe997f3420baadc81ff755e4a5ff232abf9f1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiosplunk-0.2.4-py3-none-any.whl:

Publisher: publish.yml on cschmidt0121/aiosplunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page