Class JSONLogMessage

java.lang.Object
com.unboundid.ldap.sdk.unboundidds.logs.v2.json.JSONLogMessage
All Implemented Interfaces:
LogMessage, Serializable
Direct Known Subclasses:
JSONAccessLogMessage

This class provides a data structure that holds information about a JSON-formatted log message.
NOTE: This class, and other classes within the com.unboundid.ldap.sdk.unboundidds package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.
See Also:
  • Constructor Details

    • JSONLogMessage

      protected JSONLogMessage(@NotNull JSONObject jsonObject) throws LogException
      Creates a new JSON log message from the provided JSON object.
      Parameters:
      jsonObject - The JSON object that contains an encoded representation of this log message. It must not be null.
      Throws:
      LogException - If the provided JSON object cannot be parsed as a valid log message.
  • Method Details

    • getJSONObject

      Retrieves the JSON object that contains an encoded representation of this log message.
      Returns:
      The JSON object that contains an encoded representation of this log message.
    • getTimestamp

      @NotNull public final Date getTimestamp()
      Retrieves the timestamp for this log message.
      Specified by:
      getTimestamp in interface LogMessage
      Returns:
      The timestamp for this log message.
    • getLogType

      @Nullable public final String getLogType()
      Retrieves the type of logger with which this message is associated.
      Returns:
      The type of logger with which this message is associated, or null if it is not included in the log message.
    • getFields

      @NotNull public final Map<String,List<String>> getFields()
      Retrieves a map of the fields and their corresponding values in this log message.
      Specified by:
      getFields in interface LogMessage
      Returns:
      A map of the fields and their corresponding values in this log message.
    • getBoolean

      @Nullable public final Boolean getBoolean(@NotNull LogField logField) throws LogException
      Retrieves the value of the specified field as a Boolean object. If the field has multiple values, the first will be returned.
      Specified by:
      getBoolean in interface LogMessage
      Parameters:
      logField - The field for which to retrieve the Boolean value.
      Returns:
      The value of the specified field as a Boolean object, or null if the log message does not have the specified field.
      Throws:
      LogException - If the value of the specified field cannot be parsed as a Boolean.
    • getGeneralizedTime

      Retrieves the value of the specified field as a Date object decoded from the generalized time format. If the field has multiple values, the first will be returned.
      Specified by:
      getGeneralizedTime in interface LogMessage
      Parameters:
      logField - The field for which to retrieve the timestamp value.
      Returns:
      The value of the specified field as a Date object, or null if the log message does not have the specified field.
      Throws:
      LogException - If the value of the specified field cannot be parsed as a Date in the generalized time format.
    • getDouble

      @Nullable public final Double getDouble(@NotNull LogField logField) throws LogException
      Retrieves the value of the specified field as a Double value. If the field has multiple values, the first will be returned.
      Specified by:
      getDouble in interface LogMessage
      Parameters:
      logField - The field for which to retrieve the Double value.
      Returns:
      The value of the specified field as a Double value, or null if the log message does not have the specified field.
      Throws:
      LogException - If the value of the specified field cannot be parsed as a Double.
    • getInteger

      @Nullable public final Integer getInteger(@NotNull LogField logField) throws LogException
      Retrieves the value of the specified field as an Integer value. If the field has multiple values, the first will be returned.
      Specified by:
      getInteger in interface LogMessage
      Parameters:
      logField - The field for which to retrieve the Integer value.
      Returns:
      The Integer value of the specified field, or null if the log message does not have the specified field.
      Throws:
      LogException - If the value of the specified field cannot be parsed as an Integer.
    • getLong

      @Nullable public final Long getLong(@NotNull LogField logField) throws LogException
      Retrieves the value of the specified field as a Long value. If the field has multiple values, the first will be returned.
      Specified by:
      getLong in interface LogMessage
      Parameters:
      logField - The field for which to retrieve the Long value.
      Returns:
      The Long value of the specified field, or null if the log message does not have the specified field.
      Throws:
      LogException - If the value of the specified field cannot be parsed as a Long.
    • getRFC3339Timestamp

      Retrieves the value of the specified field as a Date object decoded from the ISO 8601 format described in RFC 3339. If the field has multiple values, the first will be returned.
      Specified by:
      getRFC3339Timestamp in interface LogMessage
      Parameters:
      logField - The field for which to retrieve the timestamp value.
      Returns:
      The value of the specified field as a Date object, or null if the log message does not have the specified field.
      Throws:
      LogException - If the value of the specified field cannot be parsed as a Date in the RFC 3339 format.
    • getString

      @Nullable public final String getString(@NotNull LogField logField)
      Retrieves the value of the specified field as a string. If the field has multiple values, the first will be returned.
      Specified by:
      getString in interface LogMessage
      Parameters:
      logField - The field for which to retrieve the string value.
      Returns:
      The value of the specified field as a string, or null if the log message does not have the specified field.
    • toString

      @NotNull public final String toString()
      Retrieves a string representation of this log message.
      Specified by:
      toString in interface LogMessage
      Overrides:
      toString in class Object
      Returns:
      A string representation of this log message.