| | |
| | | import org.forgerock.opendj.server.config.server.SizeLimitLogRotationPolicyCfg; |
| | | import org.forgerock.opendj.server.config.server.TimeLimitLogRotationPolicyCfg; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | | * Entry point for the common audit facility. |
| | |
| | | { |
| | | return existingAuditServiceProxy; |
| | | } |
| | | |
| | | } |
| | | |
| | | private AuditServiceProxy buildAuditService(AuditServiceSetup setup) |
| | |
| | | else if (policyConfig instanceof TimeLimitLogRotationPolicyCfg) |
| | | { |
| | | long rotationInterval = ((TimeLimitLogRotationPolicyCfg) policyConfig).getRotationInterval(); |
| | | fileRotation.setRotationInterval(String.valueOf(rotationInterval) + " ms"); |
| | | fileRotation.setRotationInterval(rotationInterval + " ms"); |
| | | } |
| | | else |
| | | { |
| | |
| | | try |
| | | { |
| | | int time = Integer.valueOf(timeOfDay.substring(0, 2)) * 60 + Integer.valueOf(timeOfDay.substring(2, 4)); |
| | | times.add(String.valueOf(time) + " minutes"); |
| | | times.add(time + " minutes"); |
| | | } |
| | | catch (NumberFormatException | IndexOutOfBoundsException e) |
| | | { |
| | | throw new ConfigException(ERR_COMMON_AUDIT_INVALID_TIME_OF_DAY.get(publisher.getDn(), timeOfDay, |
| | | StaticUtils.stackTraceToSingleLineString(e))); |
| | | throw new ConfigException(ERR_COMMON_AUDIT_INVALID_TIME_OF_DAY.get( |
| | | publisher.getDn(), timeOfDay, stackTraceToSingleLineString(e))); |
| | | } |
| | | } |
| | | return times; |
| | |
| | | { |
| | | return config.dn().hashCode(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** Types of audit handlers managed. */ |
| | |
| | | CSV, JSON, EXTERNAL |
| | | } |
| | | |
| | | /** Log types for LDAP or HTTP, to get specific configuration depending on the handler. **/ |
| | | /** Log types for LDAP or HTTP, to get specific configuration depending on the handler. */ |
| | | private enum LogType |
| | | { |
| | | UNCONFIGURED |
| | |
| | | * a common ancestor with all the parameters (e.g Access Log, HTTP Access Log, ...), hence this class |
| | | * is necessary to avoid duplicating code that setup configuration of the handler. |
| | | */ |
| | | private abstract static class HandlerConfigData |
| | | private static abstract class HandlerConfigData |
| | | { |
| | | private final String logDirectory; |
| | | private final SortedSet<String> rotationPolicies; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Contains common parameters for the Json handler. |
| | | */ |
| | | /** Contains common parameters for the Json handler. */ |
| | | private static class JsonConfigData extends HandlerConfigData |
| | | { |
| | | JsonConfigData(String logDirectory, SortedSet<String> rotationPolicies, SortedSet<String> retentionPolicies) |
| | |
| | | return configurationFile; |
| | | } |
| | | } |
| | | |
| | | } |