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.3.1.tar.gz (5.7 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.3.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aiosplunk-0.3.1.tar.gz
Algorithm Hash digest
SHA256 744748eae0811d2421cc74aeab1b758fade4891fecda41aef1db09cc25766f81
MD5 a6b7a151c85be05f9c4b67dc127b3a41
BLAKE2b-256 866d1330ff25ba8ef3e0e738f63a5434bed08c4b1abae3f1b8501dc1948331d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiosplunk-0.3.1.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.3.1-py3-none-any.whl.

File metadata

  • Download URL: aiosplunk-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36622f338ea3d49f5f813aab5e77a85bd13efdc7753008da210a2c8634a9237e
MD5 806898b08127ce6d78de138f6e2acc16
BLAKE2b-256 a925eb1a56972ba4314c45156cffdffa2f328c416013b63d04607730b84cc27c

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiosplunk-0.3.1-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