Contained WithinFind More DocumentationFeatured Support Resources | Descargar este libro en PDF (920 KB)
Chapter 6 LoggingAccess Manager provides a logging feature that records information such as user logins and logouts, session creation, policy evaluation, and other events. You can use Access Manager logs to audit system usage and to troubleshoot problems. Logging APIs enable external applications to access the Logging feature. This chapter describes how Access Manager logging works. The chapter contains the following sections: How the Logging Feature WorksThe Logging Service enables Access Manager services to record information such as access denials, access approvals, authentication events, and authorization violations. Administrators can use the logs to track user actions, analyze traffic patterns, and review authorization violations. The logged information from all Access Manager services are recorded in one centralized location. The default location for all Access Manager log files is /var/opt/SUNWam/logs. Logging ArchitectureWhen Access Manager starts up or when any logging configuration data is changed through the console, logging configuration data is loaded into the Logging component. This data includes the log message format, log file name, maximum log size, and the number of history files. Applications can use the Client APIs to access the Logging features from a local or remote server. The Client APIs use an XML-over-HTTP layer to send logging requests to the Logging component on the server where Access Manager is installed. amLogging.xmlThe Logging service stores the attributes and values for the logging function. A global service configuration file named amLogging.xml defines the Logging attributes. Examples of Logging Service attributes are maximum log size, log location, and log format (flat file or relational database). The attribute values are applied across the Access Manager deployment and inherited by every configured realm. By default, amLogging.xml is located in the directory /etc/opt/SUNWam/config/xml. The structure of amLogging.xml is defined by file sms.dtd. Log File FormatsAccess Manager can record events in flat text files or in a relational database. Flat File FormatThe default flat file format is the W3C Extended Log Format (ELF). Access Manager uses this format to record the default fields in each log record. See Recorded Events for a list of default fields and their descriptions. The following code example illustrates an authentication log record formatted for a flat file. Example 6–1 Flat File Record From amAuthentication.access
In the example, the fields are in this order: Time, Data, ModuleName, MessageID, Domain, ContextID, LogLevel, LoginID, IPAddr, LoggedBy, and HostName. Relational Database FormatWhen Access Manager uses a relational database to log messages, the messages are stored in a database table. Access Manager uses Java Database Connectivity (JDBC) to access the database table. JDBC provides connectivity to a wide range of SQL databases. JDBC also provides access to other tabular data sources such as spreadsheets or flat files. Oracle® and MySQL databases are currently supported. For log records generated by Access Manager 7.0, the Data and MessageID fields are used slightly differently than in previous Access manager versions. Starting with Access Manager 7.0, the MessageID field is introduced as a kind of template for types of log messages. For example, in previous versions, Access Manager would generate the following message in the Data field: Data: "Created group cn=agroupSubscription1,ou=Groups,dc=iplanet,dc=com" In Access Manager 7.0, two log records are recorded for the one event: Data: agroupSubscription1|group|/ MessageID: CONSOLE-1 and Data: agroupSubscription1|group|/ MessageID: CONSOLE-2 The log records reflect the use of identities and realms, new in Access Manager 7.0. In this example, CONSOLE-1 indicates an attempt to create an identity, and CONSOLE-2 indicates the attempt to create an identity was successful. The root organization notation (dc=iplanet,dc=com) is replaced with a forward slash (/). The variable parts of the messages (agroupSubscription1, group, and /) are separated by a pipe character (|), and continue to go into the Data field of each log record. The MessagID string is not internationalized in order to facilitate machine-readable analysis of the log records in any locale. The following table summarizes the schema for a relational database. Table 6–1 Relational Database Log Format
Log Files DirectoryThe log files record a number of events for each of the Access Manager components using the Logging Service. Administrators typically review these log files on a regular basis. The default location for all Access Manager log files is /var/opt/SUNWam/logs. The following table describes the files in the log files directory. The period (.) separator in a log filename is converted to an underscore (_) in database formats. Also in databases, table names may be converted to all upper case. For example, amConsole.access may be converted to AMCONSOLE_ACCESS, or it may be converted to amConsole_access. Table 6–2 Files in the Log Files Directory
Recorded EventsThe client passes the Logging Service logs information to the com.sun.identity.log.LogRecord class. The following table summarizes the items logged by default in the LogRecord. Table 6–3 Events Recorded in LogRecord
Error and Access LogsTwo types of Access Manager log files exist: access log files and error log files. Access log files record general auditing information concerning the Access Manager deployment. A log may contain a single record for an event such as a successful authentication. A log may contain multiple records for the same event. For example, when an administrator uses the console to change an attribute value, the Logging Service logs the attempt to change in one record. Logging Service also logs the results of the execution of the change in a second record. Error log files record errors that occur within the application. While an operation error is recorded in the error log, the operation attempt is recorded in the access log file. Flat log files are appended with the .error or .access extension. Database column names end with _ERROR or _ACCESS. For example, a flat file logging console events is named amConsole.access while a database column logging the same events is named AMCONSOLE_ACCESS or amConsole_access. For detailed reference information about events recorded in each type of Access Manager, log see the Sun Java System Access Manager 7 2005Q4 Administration Guide. The following table provides a brief description of the log file produced by each Access Manager component. Table 6–4 Access Manager Component Logs
Additional Logging FeaturesYou can enable a number of logging features for added functionality. The additional features include secure logging, command-line logging, and remote logging. Secure LoggingThis feature adds an extra measure of security to the logging feature. When secure logging is enabled, the Logging component can detect unauthorized changes to the security logs. No special coding is required to leverage this feature. However, secure logging uses a certificate that you must create and install in the container that runs Access Manager. When secure logging is enabled, a Manifest Analysis and Certification (MAC) is generated and stored for every log record, and a special signature record is periodically inserted in the log. The signature record represents the signature for the contents of the log written up to that point. The combination of the certificate and the signature record ensures that the logs have not been tampered. For detailed information about enabling secure logging, see the Sun Java System Access Manager 7 2005Q4 Administration Guide. Remote LoggingRemote logging allows a client using the Client APIs to create log records on an instance of Access Manager deployed on a remote machine. Remote logging is useful in the following situations:
Log ReadingAccess Manager provides Logging APIs for writing your own custom log reading program. You can set up queries to retrieve specific records from the log file or database. This is useful for auditing purposes. For more information, see the Sun Java System Access Manager 7 2005Q4 Developer’s Guide. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||