public abstract class Script extends Object
Script
class is an abstract base class for implementing modular inputs. Subclasses
should override getScheme
and streamEvents
, and optional configureValidator
if the modular
input is using external validation.Constructor and Description |
---|
Script() |
Modifier and Type | Method and Description |
---|---|
abstract Scheme |
getScheme()
Gets the scheme that defines the parameters understood by this modular input.
|
int |
run(String[] args)
Encodes all the common behavior of modular inputs.
|
int |
run(String[] args,
EventWriter eventWriter,
InputStream in)
Encodes all the common behavior of modular inputs.
|
protected String |
stackTraceToLogEntry(Exception e) |
abstract void |
streamEvents(InputDefinition inputs,
EventWriter ew)
Streams events into Splunk.
|
void |
validateInput(ValidationDefinition definition)
Handles external validation for modular input kinds.
|
public int run(String[] args)
args
- An array of command line arguments passed to this script.public int run(String[] args, EventWriter eventWriter, InputStream in)
args
- An array of command line arguments passed to this script.eventWriter
- An EventWriter
.in
- An InputStream
.public abstract Scheme getScheme()
Scheme
object representing the parameters for this modular input.public void validateInput(ValidationDefinition definition) throws Exception
definition
- The parameters for the proposed input passed by splunkd.Exception
- The exception instancepublic abstract void streamEvents(InputDefinition inputs, EventWriter ew) throws MalformedDataException, XMLStreamException, IOException
EventWriter
rather than assuming that there is a console attached.inputs
- InputDefinition instanceew
- An object with methods to write events and log messages to Splunk.MalformedDataException
- The MalformedDataException instanceXMLStreamException
- The XMLStreamException instanceIOException
- The IOException instanceCopyright © 2022 Splunk, Inc.. All rights reserved.