public abstract class Script
extends java.lang.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(java.lang.String[] args)
Encodes all the common behavior of modular inputs.
|
int |
run(java.lang.String[] args,
EventWriter eventWriter,
java.io.InputStream in)
Encodes all the common behavior of modular inputs.
|
protected java.lang.String |
stackTraceToLogEntry(java.lang.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(java.lang.String[] args)
args
- An array of command line arguments passed to this script.public int run(java.lang.String[] args, EventWriter eventWriter, java.io.InputStream in)
args
- An array of command line arguments passed to this script.eventWriter
- An EventWriter
.in
- An InputStream
.protected java.lang.String stackTraceToLogEntry(java.lang.Exception e)
public abstract Scheme getScheme()
Scheme
object representing the parameters for this modular input.public void validateInput(ValidationDefinition definition) throws java.lang.Exception
definition
- The parameters for the proposed input passed by splunkd.java.lang.Exception
public abstract void streamEvents(InputDefinition inputs, EventWriter ew) throws MalformedDataException, javax.xml.stream.XMLStreamException, java.io.IOException
EventWriter
rather than assuming that there is a console attached.ew
- An object with methods to write events and log messages to Splunk.MalformedDataException
javax.xml.stream.XMLStreamException
java.io.IOException