Interface AuditLogService

  • All Known Implementing Classes:
    DefaultAuditLogService

    public interface AuditLogService
    Service allowing you to register audit messages against the system or against plans. Audit messages allow you to track changes to configuration.
    • Method Detail

      • log

        void log​(@NotNull
                 @NotNull AuditLogEntry msg)
        Add a log to the audit log.
        Parameters:
        msg - (fully populated) to be logged
      • log

        void log​(@NotNull
                 @NotNull String msg)
        Add a message to the system audit log. Message will be logged against the user that is currently set in the authentication context.
        Parameters:
        msg - the text of the message to add.
      • log

        void log​(@NotNull
                 @NotNull Collection<AuditLogService.FieldChange> changes,
                 @Nullable
                 @Nullable Key key)
        Add 'field change' messages to the system audit log. The messages will be logged against the user that is currently set in the authentication context. If key is not null the message will be logged against the given entity.
      • log

        void log​(@NotNull
                 @NotNull Iterable<AuditLogService.FieldChange> changes,
                 @Nullable
                 @Nullable AuditLogEntity entity)
        Add 'field change' messages to the system audit log. The messages will be logged against the user that is currently set in the authentication context. The message will be logged with the given entity type.
      • log

        void log​(@NotNull
                 @NotNull String fieldName,
                 @Nullable
                 @Nullable String oldValue,
                 @Nullable
                 @Nullable String newValue,
                 @Nullable
                 @Nullable Key plan)
        Add 'field change' message to the system audit log. The messages will be logged against the user that is currently set in the authentication context. If plan key is not null the message will be logged against the given plan.
      • log

        @Deprecated
        default void log​(@NotNull
                         @NotNull String fieldName,
                         @Nullable
                         @Nullable String oldValue,
                         @Nullable
                         @Nullable String newValue,
                         @Nullable
                         @Nullable Key planKey,
                         @Nullable
                         @Nullable AuditLogEntity entity)
        Deprecated.
        since 6.7
        Add 'field change' message to the system audit log. The messages will be logged against the user that is currently set in the authentication context. If plan key is not null the message will be logged against the given plan.
        Parameters:
        entity - job's task or chain's stage affected by the change
      • log

        void log​(@NotNull
                 @NotNull String fieldName,
                 @Nullable
                 @Nullable String oldValue,
                 @Nullable
                 @Nullable String newValue,
                 @Nullable
                 @Nullable Key key,
                 AuditLogEntityType entityType,
                 @Nullable
                 @Nullable AuditLogEntity entity)
        Add 'field change' message to the system audit log. The messages will be logged against the user that is currently set in the authentication context. If plan key is not null the message will be logged against the given plan.
        Parameters:
        entity - job's task or chain's stage affected by the change
      • log

        void log​(@Nullable
                 @Nullable com.atlassian.user.User user,
                 @NotNull
                 @NotNull String msg)
        Add a message to the system audit log. Message will be logged against the current logged in user (if available)
        Parameters:
        user - who caused the event being logged
        msg - the text of the message to add.
      • log

        @Deprecated
        default void log​(@NotNull
                         @NotNull String msg,
                         @Nullable
                         @Nullable Key plan)
        Deprecated.
        since 6.7
        Add a message to the plans audit log. Message will be logged against the current logged in user (if available)
        Parameters:
        msg - to log
        plan - to log it against
      • log

        void log​(@NotNull
                 @NotNull String msg,
                 @Nullable
                 @Nullable Key key,
                 AuditLogEntityType entityType)
        Add a message to the plans audit log. Message will be logged against the current logged in user (if available)
        Parameters:
        msg - to log
        key - to log it against
      • log

        @Deprecated
        default void log​(@NotNull
                         @NotNull String s,
                         @Nullable
                         @Nullable Key planKey,
                         @Nullable
                         @Nullable AuditLogEntity entity)
        Deprecated.
        since 6.7
        Add a message to the plans audit log. Message will be logged against the current logged in user (if available)
        Parameters:
        s - to log
        planKey - to log it against
        entity - job's task, chain' stage etc. to log against
      • log

        void log​(@NotNull
                 @NotNull String s,
                 @Nullable
                 @Nullable Key key,
                 @Nullable
                 @Nullable AuditLogEntityType entityType,
                 @Nullable
                 @Nullable AuditLogEntity entity)
        Add a message to the entity's audit log. Message will be logged against the current logged in user (if available)
        Parameters:
        s - to log
        key - to log it against
        entity - job's task, chain' stage etc. to log against
      • log

        @Deprecated
        default void log​(@Nullable
                         @Nullable com.atlassian.user.User user,
                         @NotNull
                         @NotNull String msg,
                         @Nullable
                         @Nullable Key plan)
        Deprecated.
        since 6.7
        Add a message to the plan's audit log. Message will be logged against provided user
        Parameters:
        user - who caused the event being logged
        msg - to be logged
        plan - to log the message against.
      • log

        void log​(@Nullable
                 @Nullable com.atlassian.user.User user,
                 @NotNull
                 @NotNull String msg,
                 @Nullable
                 @Nullable Key key,
                 @Nullable
                 @Nullable AuditLogEntityType entityType)
        Add a message to the entity's audit log. Message will be logged against provided user
        Parameters:
        user - who caused the event being logged
        msg - to be logged
        key - to log the message against.
      • log

        @Deprecated
        default void log​(@Nullable
                         @Nullable com.atlassian.user.User user,
                         @NotNull
                         @NotNull String msg,
                         @Nullable
                         @Nullable Key planKey,
                         @Nullable
                         @Nullable AuditLogEntity entity)
        Deprecated.
        since 6.7
        Add a message to the plans audit log. Message will be logged against provided user
        Parameters:
        user - who caused the event being logged
        msg - to be logged
        planKey - to log the message against.
        entity - header of job's task, chain' stage etc. to log against
      • log

        void log​(@Nullable
                 @Nullable com.atlassian.user.User user,
                 @NotNull
                 @NotNull String msg,
                 @Nullable
                 @Nullable Key key,
                 @Nullable
                 @Nullable AuditLogEntityType entityType,
                 @Nullable
                 @Nullable AuditLogEntity entity)
        Add a message to the plans audit log. Message will be logged against provided user
        Parameters:
        user - who caused the event being logged
        msg - to be logged
        key - to log the message against.
        entity - header of job's task, chain' stage etc. to log against
      • getAuditLogMessagesForPlan

        List<AuditLogEntry> getAuditLogMessagesForPlan​(@NotNull
                                                       @NotNull ImmutablePlan plan,
                                                       long startDate,
                                                       long endDate,
                                                       int firstResult,
                                                       int maxResults)
        Provide a paginated list of all audit log messages written against a plan between input dates.
        Parameters:
        plan - to find audit messages for
        startDate - if specified, messages before this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set a start range.
        endDate - if specified, messages after this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set an end range.
        firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
        maxResults - if specified marks a total number of items to be returned, passing 0 or negative number will effect with returning all elements until the end
        Returns:
        List of audit log entries for the given plan
      • getAuditLogMessagesForPlan

        @ExperimentalApi
        List<AuditLogEntry> getAuditLogMessagesForPlan​(@NotNull
                                                       @NotNull ImmutablePlan plan,
                                                       long startDate,
                                                       long endDate,
                                                       int firstResult,
                                                       int maxResults,
                                                       @Nullable
                                                       @Nullable String searchTerm)
        Provide a paginated list of all audit log messages written against a plan between input dates and requested search term.
        Parameters:
        plan - to find audit messages for
        startDate - if specified, messages before this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set a start range.
        endDate - if specified, messages after this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set an end range.
        firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
        maxResults - if specified marks a total number of items to be returned, passing 0 or negative number will effect with returning all elements until the end
        searchTerm - value against which the results are filtered out
        Returns:
        List of audit log entries for the given plan
        Since:
        9.1
      • getAgentAuditLogsMessagesByAgentName

        List<AuditLogEntry> getAgentAuditLogsMessagesByAgentName​(String agentName)
        Provide a list of audit log messages filter by Agent Name
        Parameters:
        agentName - the name of the agent
        Returns:
        List of audit log entries for the given Agent Name
      • getAgentAuditLogsMessagesByAgentName

        @ExperimentalApi
        List<AuditLogEntry> getAgentAuditLogsMessagesByAgentName​(String agentName,
                                                                 @Nullable
                                                                 @Nullable String searchTerm)
        Provide a list of audit log messages filter by Agent Name and the Search Term.
        Parameters:
        agentName - the name of the agent
        searchTerm - the value searched in the Agent related audit log
        Returns:
        List of audit log entries for the given Agent Name and Search Term.
        Since:
        9.1
      • getGlobalAuditLogMessages

        List<AuditLogEntry> getGlobalAuditLogMessages​(int firstResult,
                                                      int maxResults)
        Provide a page of a list of all audit log messages written against the system.
        Returns:
        a list of audit log entries for the system
      • getGlobalAuditLogMessages

        @ExperimentalApi
        List<AuditLogEntry> getGlobalAuditLogMessages​(int firstResult,
                                                      int maxResults,
                                                      @Nullable
                                                      @Nullable String searchTerm)
        Provide a page of a list of all audit log messages written against the system filtered by delivered searchTerm.
        Parameters:
        firstResult -
        maxResults -
        searchTerm - the phrase against which the search will be made
        Returns:
        a list of audit log entries for the system
        Since:
        9.1
      • countGlobalAuditLogMessages

        long countGlobalAuditLogMessages()
        Count global audit log messages.
        Returns:
        number of potential results
      • countGlobalAuditLogMessages

        @ExperimentalApi
        long countGlobalAuditLogMessages​(@Nullable
                                         @Nullable String searchTerm)
        Count global audit log messages.
        Parameters:
        searchTerm - the phrase against which the results will be counted
        Returns:
        number of potential results
        Since:
        9.1
      • countAuditLogMessagesForPlan

        long countAuditLogMessagesForPlan​(@NotNull
                                          @NotNull ImmutablePlan plan)
        Count audit log messages for plan
      • countAuditLogMessagesForPlan

        long countAuditLogMessagesForPlan​(@NotNull
                                          @NotNull ImmutablePlan plan,
                                          long startDate,
                                          long endDate)
        Count audit log messages for plan in a given time period
      • countAuditLogMessagesForPlan

        @ExperimentalApi
        long countAuditLogMessagesForPlan​(@NotNull
                                          @NotNull ImmutablePlan plan,
                                          long startDate,
                                          long endDate,
                                          @Nullable
                                          @Nullable String searchTerm)
        Count audit log messages for plan in a given time period and with the requested searchTerm
        Since:
        9.1
      • countAuditLogMessagesForEntity

        long countAuditLogMessagesForEntity​(@NotNull
                                            @NotNull String entityId,
                                            @Nullable
                                            @Nullable AuditLogEntityType entityType,
                                            long startDate,
                                            long endDate)
        Count audit log messages for entity in a given time period
      • countAuditLogMessagesForEntity

        @ExperimentalApi
        long countAuditLogMessagesForEntity​(@NotNull
                                            @NotNull String entityId,
                                            @Nullable
                                            @Nullable AuditLogEntityType entityType,
                                            long startDate,
                                            long endDate,
                                            @Nullable
                                            @Nullable String searchTerm)
        Count audit log messages for entity in a given time period and with the requested searchTerm
        Since:
        9.1
      • removeGlobalAuditLogMessages

        void removeGlobalAuditLogMessages()
        Deletes all Global audit log messages
      • hasAuditLogMessagesForPlan

        boolean hasAuditLogMessagesForPlan​(@NotNull
                                           @NotNull ImmutablePlan plan,
                                           long startDate,
                                           long endDate)
        Determine whether any log messages have been recorded against the specified plan between the startDate and endDate (inclusive). This is equivalent to but usually faster than checking the emptiness of getAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int).
        Parameters:
        startDate - if specified, messages before this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set a start range.
        endDate - if specified, messages after this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set an end range.
      • removeAuditLogMessagesForPlan

        void removeAuditLogMessagesForPlan​(@NotNull
                                           @NotNull ImmutablePlan plan)
        Deletes all log messages for a given plan
        Parameters:
        plan - to delete messages for
      • removeAuditLogMessagesByTypeAndEntityId

        void removeAuditLogMessagesByTypeAndEntityId​(@NotNull
                                                     @NotNull String entityId,
                                                     @Nullable
                                                     @Nullable AuditLogEntityType entityType)
      • removeAllAuditLogMessages

        void removeAllAuditLogMessages()
        Deletes all log messages in the database
      • isEnabled

        boolean isEnabled()
        Returns whether logging is enabled
      • setEnabled

        void setEnabled​(boolean enabled)
        sets whether logging is enabled or not
      • getAuditLogMessagesForEntity

        @ExperimentalApi
        List<AuditLogEntry> getAuditLogMessagesForEntity​(@NotNull
                                                         @NotNull String entityId,
                                                         @Nullable
                                                         @Nullable AuditLogEntityType entityType,
                                                         long startDate,
                                                         long endDate,
                                                         int firstResult,
                                                         int maxResults,
                                                         @Nullable
                                                         @Nullable String searchTerm)
        Provide a paginated list of all audit log messages written against an entity between input dates and requested search term.
        Parameters:
        entityId - to find audit messages for
        entityType - type of entity associated with the entityId
        startDate - if specified, messages before this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set a start range.
        endDate - if specified, messages after this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set an end range.
        firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
        maxResults - if specified marks a total number of items to be returned, passing 0 or negative number will effect with returning all elements until the end
        searchTerm - value against which the results are filtered out
        Returns:
        List of audit log entries for the given entity
        Since:
        9.1
      • getAuditLogMessagesForEntity

        List<AuditLogEntry> getAuditLogMessagesForEntity​(@NotNull
                                                         @NotNull String entityId,
                                                         @Nullable
                                                         @Nullable AuditLogEntityType entityType,
                                                         long startDate,
                                                         long endDate,
                                                         int firstResult,
                                                         int maxResults)
        Provide a paginated list of all audit log messages written against an entity between input dates.
        Parameters:
        entityId - to find audit messages for
        entityType - type of entity associated with the entityId
        startDate - if specified, messages before this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set a start range.
        endDate - if specified, messages after this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set an end range.
        firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
        maxResults - if specified marks a total number of items to be returned, passing 0 or negative number will effect with returning all elements until the end
        Returns:
        List of audit log entries for the given entity
      • isRssUpdatedLog

        boolean isRssUpdatedLog()
        Returns:
        whether logging is for RSS update.
      • setRssUpdatedLog

        void setRssUpdatedLog​(Boolean isRss)
        sets whether logging is for RSS update.