WWW::Splunk::API(3pm)

πŸ“¦
version 2.09 Β· 2 versions
, in fedora 43

πŸ’– WWW::Splunk::API πŸ’–

okay bestie, gather round, because we're talking about WWW::Splunk::API β€” a perl manual page, section 3pm, from the User Contributed Perl Documentation collection. it's giving infrastructure, it's giving main character energy, and honestly? it slays. 🌈


✨ NAME ✨

WWW::Splunk::API β€” your literal Splunk REST client. that's the whole name, no cap. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so WWW::Splunk::API is a low-level interface to the Splunk log search engine. it's the one handling all the HTTP communication for you, and it also does the unglamorous work of working around certain interface glitches so you don't have to cry about them. 🫢

if you want the actual API definition, it lives here:

<https://www.splunk.com/base/Documentation/latest/Developer/RESTSearch>

(that's the link, exactly as the page gives it: <http://www.splunk.com/base/Documentation/latest/Developer/RESTSearch>)

and here's the iconic part: this module is designed to be Splunk API version agnostic. she does not pick favorites. she works with all of them. periodt. πŸ‘‘


🌸 new (params) 🌸

a constructor, babes. you make a Splunk object like this:

my $splunk = WWW::Splunk::API->new({
        host => $host,
        port => $port,
        login => $login,
        password => $password,
        unsafe_ssl => 0,
        verbose => 0,
});

and the default values are, in order:

  • port β€” 8089
  • host β€” localhost
  • url β€” https://$host:$port
  • verbose β€” 0
  • unsafe_ssl β€” 0
  • service_prefix β€” /services
  • search β€” 1
like, if you don't pass any of these, that's what you get. no surprises. we love a predictable queen. πŸ’–

πŸŽ€ delete (parameters) πŸŽ€

a cute lil wrapper around HTTP::Request::Common::DELETE(). that's it, that's the whole vibe. πŸ—‘οΈ


🌟 post (parameters) 🌟

wrapper around HTTP::Request::Common::POST(). sending it. πŸ’Œ


πŸ¦„ get (parameters) πŸ¦„

wrapper around HTTP::Request::Common::GET(). fetching the tea. β˜•


πŸ’« head (parameters) πŸ’«

wrapper around HTTP::Request::Common::HEAD(). and heads up: it's not used anywhere in splunk API. she's just sitting there, existing, being iconic for no reason. πŸ™ˆ


πŸ“ put (parameters) πŸ“

wrapper around HTTP::Request::Common::PUT(). and yeah β€” same situation, this one is not used anywhere in splunk API either. two for two. πŸ’€


🌈 request (method, location, [data], [callback]) 🌈

the big one. this requests a Splunk api and deals with the results for you. 🫑

Method can be either:

  • an HTTP::Request instance β€” peep HTTP::Request::Common for useful ones β€” or
  • a plain string, such as "GET" or "DELETE."

the optional data is a hash reference, and it gets serialized into a request body for a POST request. and listen: use undef in case you don't have any data to send, but you still need to specify a callback function in the subsequent argument. iykyk. ✨

the call-back function can be specified for a single special case, where a XML stream of <results> elements is expected. that's the one and only scenario, bestie. 🎯


πŸ‘€ SEE ALSO πŸ‘€

  • WWW::Splunk
  • sc

πŸ’œ AUTHORS πŸ’œ

the legends themselves:

  • Lubomir Rintel, <lkundrak@v3.sk>
  • Michal Josef Ε paček <skim@cpan.org>

and the code is hosted on GitHub β€” <http://github.com/michal-josef-spacek/perl-WWW-Splunk> β€” where bug fixes and feature enhancements are always welcome. come thru, contributors, we're rooting for you fr fr. 🫢


πŸ“œ LICENSE πŸ“œ

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. iconic behavior. πŸ’–


so yeah, that's the whole page, and it came from perl version v5.42.0, dated 2025-07-25, from the WWW::Splunk::API(3pm) manual. slay, go search some logs, drink water, and remember: your HTTP communication is handled. πŸŒΈπŸ’…βœ¨

πŸ“¦ where this page comes from