@Override public LoggingConfiguration getConfiguration(final Path container) throws BackgroundException { try { final ServiceProperties properties = session.getClient().downloadServiceProperties(null, context); final LoggingConfiguration configuration = new LoggingConfiguration( !properties.getLogging().getLogOperationTypes().isEmpty(), "$logs" ); // When you have configured Storage Logging to log request data from your storage account, it saves the log data // to blobs in a container named $logs in your storage account. configuration.setContainers(Collections.singletonList( new Path("/$logs", EnumSet.of(Path.Type.volume, Path.Type.directory))) ); return configuration; } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot read container configuration", e); } }
this.props.getLogging().setRetentionIntervalInDays(this.retentionPolicyDays); this.props.getLogging().setVersion(value); this.props.getLogging().getLogOperationTypes().add(LoggingOperations.DELETE); this.props.getLogging().getLogOperationTypes().add(LoggingOperations.READ); this.props.getLogging().getLogOperationTypes().add(LoggingOperations.WRITE);
this.props.getLogging().setRetentionIntervalInDays(this.retentionPolicyDays); this.props.getLogging().setVersion(value); this.props.getLogging().getLogOperationTypes().add(LoggingOperations.DELETE); this.props.getLogging().getLogOperationTypes().add(LoggingOperations.READ); this.props.getLogging().getLogOperationTypes().add(LoggingOperations.WRITE);
private void testAnalyticsLoggingOperations(ServiceClient client, ServiceProperties props) throws StorageException, InterruptedException { // None props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); props.getLogging().setRetentionIntervalInDays(null); props.getLogging().setVersion("1.0"); callUploadServiceProps(client, props, null); assertServicePropertiesAreEqual(props, callDownloadServiceProperties(client)); // None props.getLogging().setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); callUploadServiceProps(client, props, null); assertServicePropertiesAreEqual(props, callDownloadServiceProperties(client)); }
xmlw.writeStartElement(Constants.AnalyticsConstants.STORAGE_SERVICE_PROPERTIES_ELEMENT); if (properties.getLogging() != null) { writeLoggingProperties(xmlw, properties.getLogging());
xmlw.startTag(Constants.EMPTY_STRING, Constants.AnalyticsConstants.STORAGE_SERVICE_PROPERTIES_ELEMENT); if (properties.getLogging() != null) { writeLoggingProperties(xmlw, properties.getLogging());
private void testAnalyticsDisable(ServiceClient client, ServiceProperties props) throws StorageException, InterruptedException { props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); props.getLogging().setRetentionIntervalInDays(null); props.getLogging().setVersion("1.0"); props.getHourMetrics().setMetricsLevel(MetricsLevel.DISABLED); props.getHourMetrics().setRetentionIntervalInDays(null); props.getHourMetrics().setVersion("1.0"); props.getMinuteMetrics().setMetricsLevel(MetricsLevel.DISABLED); props.getMinuteMetrics().setRetentionIntervalInDays(null); props.getMinuteMetrics().setVersion("1.0"); props.getCors().getCorsRules().clear(); callUploadServiceProps(client, props, null); assertServicePropertiesAreEqual(props, callDownloadServiceProperties(client)); }
private void testOptionalServiceProperties(ServiceClient client, ServiceProperties props) throws StorageException, InterruptedException { props.getLogging().setLogOperationTypes(EnumSet.of(LoggingOperations.READ, LoggingOperations.WRITE)); props.getLogging().setRetentionIntervalInDays(5); props.getLogging().setVersion("1.0"); assertServicePropertiesAreEqual(props, callDownloadServiceProperties(client)); newProps.setLogging(props.getLogging()); newProps.setHourMetrics(props.getHourMetrics()); newProps.setMinuteMetrics(props.getMinuteMetrics());
props.getLogging().setRetentionIntervalInDays(null); props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); callUploadServiceProps(client, props, null); props.getLogging().setRetentionIntervalInDays(3); props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); callUploadServiceProps(client, props, null); props.getLogging().setRetentionIntervalInDays(null); props.getLogging().setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); callUploadServiceProps(client, props, null); props.getLogging().setRetentionIntervalInDays(4); props.getLogging().setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); callUploadServiceProps(client, props, null);
if (propsA.getLogging() != null && propsB.getLogging() != null) { assertTrue(propsA.getLogging().getLogOperationTypes().equals(propsB.getLogging().getLogOperationTypes())); assertEquals(propsA.getLogging().getRetentionIntervalInDays(), propsB.getLogging() .getRetentionIntervalInDays()); assertEquals(propsA.getLogging().getVersion(), propsB.getLogging().getVersion()); assertNull(propsA.getLogging()); assertNull(propsB.getLogging());