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.0.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.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiosplunk-0.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 3ab38e30a13fba995c5c2e96b430f23381cc943ce4f7938cfd197298cb6abe42
MD5 6ce5682012b4c2a0ac087833be4dcfa8
BLAKE2b-256 4b3c9d9bd998b17c4ad144dd02a352dca82df02fe019c388c70f2fdcb2c46f96

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: aiosplunk-0.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f287ab63504a932157f8b489f6d0842235d0f77388fa52a00ff26af3028ea6f
MD5 3c01e5f259740335fe5beb0a875dc5da
BLAKE2b-256 c632a2f2ab0f28e05d6cf7a7cd82ff8d26b7f1811caaae85f0f3c792d0437f38

See more details on using hashes here.

Provenance

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