Interface LogAccessService


public interface LogAccessService
Provides access to system log files across all log sources. Works transparently whether logs are on local disk or remote storage.

Note: This API requires a {AE_HOME}/shared-logs/ directory with at least one log source subdirectory. This directory is present on Appian Cloud deployments by default, but does not exist on self-managed (on-premise) installations. On environments where shared-logs does not exist, getLogSources() will return an empty list and other methods will not find any files.

  • Method Details

    • getLogSources

      List<String> getLogSources()
      Returns the available log sources. Each log source is a top-level directory under shared-logs that contains log files.
      Returns:
      list of log source names (e.g., ["appian-webapp-0", "logsource-1"])
    • listFiles

      List<LogFileInfo> listFiles(String relativePath) throws LogAccessException
      Lists log files and directories at the given relative path. All paths are relative to the shared-logs root and must include the log source as the first segment. Use getLogSources() to discover available log sources.
      Parameters:
      relativePath - path relative to the shared-logs root (e.g., "appian-webapp-0/audit/user_management.csv" or "logsource-1/audit/user_management.csv")
      Returns:
      metadata for each file and directory at that path
      Throws:
      LogAccessException - if the path is invalid
    • getFileInfo

      Optional<LogFileInfo> getFileInfo(String relativePath) throws LogAccessException
      Returns metadata for a single log file or directory.
      Parameters:
      relativePath - path relative to the shared-logs root, including the log source (e.g., "appian-webapp-0/audit/user_management.csv" or "logsource-1/audit/user_management.csv")
      Returns:
      file metadata wrapped in Optional, or empty if not found
      Throws:
      LogAccessException - if the path is invalid
    • readFile

      InputStream readFile(String relativePath) throws LogAccessException
      Opens an input stream to read the contents of a log file. Caller is responsible for closing the stream. The following example uses a try-with-resources block to ensure the stream is automatically closed:
      
       try (InputStream is = logAccessService.readFile("appian-webapp-0/audit/user_management.csv")) {
           BufferedReader reader = new BufferedReader(new InputStreamReader(is));
           String line;
           while ((line = reader.readLine()) != null) {
               // process line
           }
       }
       
      Parameters:
      relativePath - path relative to the shared-logs root, including the log source (e.g., "appian-webapp-0/audit/user_management.csv" or "logsource-1/audit/user_management.csv")
      Returns:
      input stream for reading the log file
      Throws:
      LogAccessException - if the path is invalid or the file cannot be read