|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.splunk.modularinput.Event
public class Event
The Event
class represents an event or fragment of an event to be written by this modular input to Splunk.
To write an Event
to an XML stream, call its writeTo
method with an XMLStreamWriter
object to write to.
The Event
must have at least the data field set or writeTo
will throw a MalformedDataException
. All other
fields are optional. If you omit the time field, the writeTo
method will fill in the current time when it is called.
Typically, you will also want to call setStanza
to specify which instance of the modular input kind this event
should go to, setTime
to set the timestamp, and setSource
, setHost
, and setSourceType
specify where this event came from.
Field Summary | |
---|---|
protected java.lang.String |
data
|
protected boolean |
done
|
protected java.lang.String |
host
|
protected java.lang.String |
index
|
protected java.lang.String |
source
|
protected java.lang.String |
sourceType
|
protected java.lang.String |
stanza
|
protected java.util.Date |
time
|
protected boolean |
unbroken
|
Constructor Summary | |
---|---|
Event()
|
Method Summary | |
---|---|
java.lang.String |
getData()
Gets the text of the event that Splunk should index. |
java.lang.String |
getHost()
Gets a host specifying the name of the network host on which this event was produced. |
java.lang.String |
getIndex()
Gets an index field specifying which index Splunk should write this event to. |
java.lang.String |
getSource()
Gets the file, service, or other producer that this Event comes from. |
java.lang.String |
getSourceType()
Gets a classification of this event. |
java.lang.String |
getStanza()
Gets the name of the input this event should be sent to. |
java.util.Date |
getTime()
Gets a java.util.Date object giving the timestamp that should be sent with this event. |
boolean |
isDone()
Gets a value indicating whether this is the last piece of an event broken across multiple Event objects. |
boolean |
isUnbroken()
Gets a value indicating whether this event is completely encapsulated in this Event object. |
void |
setData(java.lang.String data)
Sets the text of the event that Splunk should index. |
void |
setDone(boolean done)
Sets a value indicating whether this is the last piece of an event broken across multiple Event objects. |
void |
setHost(java.lang.String host)
Sets a host specifying the name of the network host on which this event was produced. |
void |
setIndex(java.lang.String index)
Sets an index field specifying which index Splunk should write this event to. |
void |
setSource(java.lang.String source)
Sets the file, service, or other producer that this Event comes from. |
void |
setSourceType(java.lang.String sourceType)
Sets a classification of this event. |
void |
setStanza(java.lang.String stanza)
Sets the name of the input this event should be sent to. |
void |
setTime(java.util.Date time)
Sets a java.util.Date object giving the timestamp that should be sent with this event. |
void |
setUnbroken(boolean unbroken)
Sets a value indicating whether this event is completely encapsulated in this Event object. |
protected void |
writeFieldTo(javax.xml.stream.XMLStreamWriter out,
java.lang.String name,
java.lang.String value)
|
void |
writeTo(javax.xml.stream.XMLStreamWriter out)
Writes this event to the given XMLStreamWriter . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Date time
protected java.lang.String data
protected java.lang.String source
protected java.lang.String sourceType
protected java.lang.String index
protected java.lang.String host
protected boolean done
protected boolean unbroken
protected java.lang.String stanza
Constructor Detail |
---|
public Event()
Method Detail |
---|
protected void writeFieldTo(javax.xml.stream.XMLStreamWriter out, java.lang.String name, java.lang.String value) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public void writeTo(javax.xml.stream.XMLStreamWriter out) throws javax.xml.stream.XMLStreamException, MalformedDataException
XMLStreamWriter
.
out
- The XMLStreamWriter
to append to.
javax.xml.stream.XMLStreamException
- if there is a problem in the XMLStreamWriter
.
MalformedDataException
- if you have not specified data for this event.public java.util.Date getTime()
java.util.Date
object giving the timestamp that should be sent with this event. If this field is null,
Splunk will assign the time at which the event is indexed as its timestamp.
java.util.Date
object giving the time assigned to this Event, or null if Splunk should apply a default
timestamp.public void setTime(java.util.Date time)
java.util.Date
object giving the timestamp that should be sent with this event. If this field is null,
Splunk will assign the time at which the event is indexed as its timestamp.
time
- The java.util.Date
which should be used as this event's timestamp, or null to have Splunk use a
default timestamp.public java.lang.String getData()
public void setData(java.lang.String data)
data
- A String containing the event text.public java.lang.String getSource()
Event
comes from. For lines in log files, it is
typically the full path to the log file. If it is omitted, Splunk will guess a sensible name for the source.
public void setSource(java.lang.String source)
Event
comes from. For lines in log files, it is
typically the full path to the log file. If it is omitted, Splunk will guess a sensible name for the source.
source
- A String to be used as the source of this event, or null to have Splunk guess.public java.lang.String getSourceType()
public void setSourceType(java.lang.String sourceType)
sourceType
- A String to use as the source type for this event, or null to have Splunk guess.public java.lang.String getIndex()
public void setIndex(java.lang.String index)
index
- The name of the index to write to, or null to have Splunk write to the default index.public java.lang.String getHost()
public void setHost(java.lang.String host)
host
- A String giving the host name of the event source, or null to use the host Splunk receives
the event from.public void setDone(boolean done)
Event
objects.
Splunk allows events from modular inputs to be sent in pieces. For example, if lines of an event become available
one at a time, they can be sent (in events with setUnbroken(false)
called on them) as hunks. At the end of the
event, you must manually tell Splunk to break after this hunk by setting done to true. Then the next event
received will be taken to be part of another event.
By default, done is true
and unbroken is true
, so if you do not touch these fields, you will send one complete
event per Event
object.
done
- Is this the last hunk of an event broken across multiple Event
objects?public boolean isDone()
Event
objects.
Splunk allows events from modular inputs to be sent in pieces. For example, if lines of an event become available
one at a time, they can be sent (in events with setUnbroken(false) called on them) as hunks. At the end of the
event, you must manually tell Splunk to break after this hunk by setting done to true. Then the next event
received will be taken to be part of another event.
By default, done is true
and unbroken is true
, so if you do not touch these fields, you will send one complete
event per Event
object.
Event
objects?public void setUnbroken(boolean unbroken)
Event
object.
Splunk allows events from modular inputs to be sent in pieces. If unbroken is set to true
, then this event is
assumed to be a complete event, not a piece of one. By default, unbroken is true
. If you set unbroken to false
,
you need to call setDone(true)
on the last hunk of the complete event for Splunk to know to terminate it.
unbroken
- Is this event completely encapsulated in this Event
object?public boolean isUnbroken()
Event
object.
Splunk allows events from modular inputs to be sent in pieces. If unbroken is set to true
, then this event is
assumed to be a complete event, not a piece of one. By default, unbroken is true
. If you set unbroken to false
,
you need to call setDone(true)
on the last hunk of the complete event for Splunk to know to terminate it.
Event
object?public java.lang.String getStanza()
public void setStanza(java.lang.String stanza)
stanza
- The name of the input this event should be sent to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |