import { ITGlueClient } from '../client'; import { QueryUtilOptions, BaseListResponse, LogResource } from '../types'; /** * Logs resource module for IT Glue API * * Provides methods to interact with the /logs endpoint. * Logs represent the audit trail of activities and changes performed within * IT Glue, providing comprehensive tracking of user actions, resource modifications, * and system events. This read-only resource enables administrators to monitor * system usage, track changes, and maintain compliance with audit requirements. * * **Note: This is a read-only resource. Logs cannot be created, updated, or deleted.** * Logs are automatically generated by IT Glue when users perform actions such as * creating, updating, or deleting resources. * * ## Related Resources * Logs are commonly used with: * - {@link Users} - User accounts performing logged actions and activities * - {@link Organizations} - Organizations where logged activities occur * - {@link UserMetrics} - User activity analytics derived from log data * - {@link Groups} - User groups and permissions involved in logged actions * - {@link Configurations} - IT assets being modified and tracked in logs * - {@link Documents} - Documents being accessed, created, or modified * - {@link Passwords} - Password-related activities and access logging * - {@link FlexibleAssets} - Custom assets being tracked in audit logs * - {@link Contacts} - Contact modifications and access logging * - {@link Exports} - Data export activities and compliance tracking * - {@link Attachments} - File upload and download activities * - {@link RelatedItems} - Resource relationship changes and audit trail * * @see {@link Users#list} for retrieving user information related to log entries * @see {@link Organizations#list} for retrieving organizational context for logs * @see {@link UserMetrics#list} for retrieving user activity metrics from log data * @see {@link Exports#list} for retrieving export activities tracked in logs * * @example * import { ITGlueClient } from '../client'; * import { Logs } from './resources/logs'; * * const client = new ITGlueClient({ apiKey: 'your-api-key' }); * const logs = new Logs(client); * * // List logs * const list = await logs.list(); * * // List logs with filtering by user * const userLogs = await logs.list({ * filter: { user_id: '123' } * }); * * // List recent logs * const recentLogs = await logs.list({ * sort: '-created_at', * page: { size: 50 } * }); * * @category System & Audit */ export declare class Logs { private client; private basePath; private paginationUtil; /** * Create a Logs resource instance * @param {ITGlueClient} client - ITGlueClient instance */ constructor(client: ITGlueClient); /** * List all logs (audit trail) * * Retrieves audit log entries with comprehensive filtering and sorting capabilities. * This read-only endpoint provides access to the complete audit trail of activities * within your IT Glue organization. Use filtering options to narrow down logs by * user, resource type, action type, date range, or specific resources. * * Logs are automatically generated and maintained by IT Glue for all user actions * and system events. They provide detailed information about who performed what * action, when it occurred, and what resources were affected. * * @param {QueryUtilOptions} [options] - Optional query parameters (filter, sort, page, etc.) * @param {boolean} [allPages=false] - If true, fetches all pages automatically * @returns {Promise>} List of audit log entries and pagination metadata * @throws {Error} When access denied (403) or invalid filter parameters (422) * @example * // List all recent logs (default sorting by newest first) * await logs.list(); * @example * // Filter logs by specific user and action type * await logs.list({ * filter: { * user_id: '123', * action: 'update' * }, * sort: '-created_at', * page: { number: 1, size: 100 } * }); * @example * // Filter logs for specific resource and date range * await logs.list({ * filter: { * resource_type: 'Organization', * resource_id: '456', * created_at: '2024-01-01..2024-12-31' * }, * include: ['user', 'resource'] * }); * @example * // Monitor security events (authentication and permission changes) * await logs.list({ * filter: { * action: ['login', 'logout', 'permission_change'], * created_at: '2024-01-01..' * }, * sort: '-created_at' * }); * @example * // Error handling for log access * try { * const logs = await logs.list({ * filter: { user_id: 'invalid-id' } * }); * } catch (error) { * if (error.response?.status === 403) { * console.log('Insufficient permissions to access audit logs'); * } else if (error.response?.status === 422) { * console.log('Invalid filter parameters:', error.response.data.errors); * } * } * @example * // Compliance reporting - export all logs for a specific period * const complianceLogs = await logs.list({ * filter: { * created_at: '2024-01-01..2024-03-31' * }, * sort: 'created_at', * include: ['user', 'resource'] * }, true); // Fetch all pages for complete audit trail */ list(options?: QueryUtilOptions, allPages?: boolean): Promise>; }