Class Log

java.lang.Object
org.netxms.client.log.Log

public class Log extends Object
Log handle for accessing log on management server
  • Constructor Details

    • Log

      public Log(NXCSession session, NXCPMessage msg, String name)
      Create log object from server's reply to CMD_LOG_OPEN.
      Parameters:
      session - Client session
      msg - NXCP message with server's reply
      name - log name
  • Method Details

    • getName

      public String getName()
      Get log name.
      Returns:
      Log name
    • hasDetailFields

      public boolean hasDetailFields()
      Check if this log has additional fields with detailed information.
      Returns:
      true if this log has additional fields with detailed information
    • getColumns

      public Collection<LogColumn> getColumns()
      Get column information
      Returns:
      the columns
    • getColumnDescription

      public String getColumnDescription(String columnName)
      Get description for given column name.
      Parameters:
      columnName - Column name
      Returns:
      Column description or null if column with given name does not exist
    • getColumn

      public LogColumn getColumn(String columnName)
      Get column object by column name.
      Parameters:
      columnName - Column name
      Returns:
      Column object or null if column with given name does not exist
    • getColumnIndex

      public int getColumnIndex(String columnName)
      Get index of given column
      Parameters:
      columnName - column name
      Returns:
      index of given column or -1 if such column does not exist
    • getRecordIdColumnName

      public String getRecordIdColumnName()
      Get name of column holding unique record ID.
      Returns:
      name of column holding unique record ID
    • getRecordIdColumnIndex

      public int getRecordIdColumnIndex()
      Get index of column holding unique record ID.
      Returns:
      index of column holding unique record ID
    • getObjectIdColumnName

      public String getObjectIdColumnName()
      Get name of column holding ID of related NetXMS object.
      Returns:
      name of column holding ID of related NetXMS object or null
    • getObjectIdColumnIndex

      public int getObjectIdColumnIndex()
      Get index of column holding ID of related NetXMS object.
      Returns:
      index of column holding ID of related NetXMS object or -1 if this log does not have related objects
    • query

      public void query(LogFilter filter) throws IOException, NXCException
      Send query to server
      Parameters:
      filter - Log filter
      Throws:
      IOException - if socket I/O error occurs
      NXCException - if NetXMS server returns an error or operation was timed out
    • retrieveData

      public Table retrieveData(long startRow, long rowCount) throws IOException, NXCException
      Retrieve log data from server. You must first call query() to prepare data on server.
      Parameters:
      startRow - start row to retrieve
      rowCount - number of rows to retrieve
      Returns:
      data set
      Throws:
      IOException - if socket I/O error occurs
      NXCException - if NetXMS server returns an error or operation was timed out
    • retrieveData

      public Table retrieveData(long startRow, long rowCount, boolean refresh) throws IOException, NXCException
      Retrieve log data from server. You must first call query() to prepare data on server.
      Parameters:
      startRow - start row to retrieve
      rowCount - number of rows to retrieve
      refresh - if set to true, server will reload data from database instead of using cache
      Returns:
      data set
      Throws:
      IOException - if socket I/O error occurs
      NXCException - if NetXMS server returns an error or operation was timed out
    • getNumRecords

      public long getNumRecords()
      Get number of records available on server after successful query() call.
      Returns:
      Number of log records available
    • getRecordDetails

      public LogRecordDetails getRecordDetails(long recordId) throws IOException, NXCException
      Get details for specific log record. Details object will contain values for all columns marked as "details column".
      Parameters:
      recordId - log record ID
      Returns:
      log record details or null if this log does not have additional fields with detailed information
      Throws:
      IOException - if socket I/O error occurs
      NXCException - if NetXMS server returns an error or operation was timed out
    • close

      public void close() throws IOException, NXCException
      Close log
      Throws:
      IOException - if socket I/O error occurs
      NXCException - if NetXMS server returns an error or operation was timed out
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: