createSessionLogger
inline suspend fun WorkSpacesWebClient.createSessionLogger(crossinline block: CreateSessionLoggerRequest.Builder.() -> Unit): CreateSessionLoggerResponse
Creates a session logger.
Samples
import aws.sdk.kotlin.services.workspacesweb.model.Event
import aws.sdk.kotlin.services.workspacesweb.model.EventFilter
import aws.sdk.kotlin.services.workspacesweb.model.FolderStructure
import aws.sdk.kotlin.services.workspacesweb.model.LogConfiguration
import aws.sdk.kotlin.services.workspacesweb.model.LogFileFormat
import aws.sdk.kotlin.services.workspacesweb.model.S3LogConfiguration
import aws.sdk.kotlin.services.workspacesweb.model.Tag
import aws.sdk.kotlin.services.workspacesweb.model.Unit
fun main() {
//sampleStart
// Creates a session logger that captures all events and stores them in S3 with JSON format and flat
// folder structure
val resp = workSpacesWebClient.createSessionLogger {
eventFilter = EventFilter.All(Unit {
}
)
logConfiguration = LogConfiguration {
s3 = S3LogConfiguration {
bucket = "my-session-logs-bucket"
keyPrefix = "session-logs/all/events"
bucketOwner = "123456789012"
logFileFormat = LogFileFormat.fromValue("Json")
folderStructure = FolderStructure.fromValue("Flat")
}
}
displayName = "Session Logger with All Events"
}
//sampleEnd
}
import aws.sdk.kotlin.services.workspacesweb.model.Event
import aws.sdk.kotlin.services.workspacesweb.model.EventFilter
import aws.sdk.kotlin.services.workspacesweb.model.FolderStructure
import aws.sdk.kotlin.services.workspacesweb.model.LogConfiguration
import aws.sdk.kotlin.services.workspacesweb.model.LogFileFormat
import aws.sdk.kotlin.services.workspacesweb.model.S3LogConfiguration
import aws.sdk.kotlin.services.workspacesweb.model.Tag
import aws.sdk.kotlin.services.workspacesweb.model.Unit
fun main() {
//sampleStart
// Creates a session logger that captures only specific events with JSONLines format and nested folder
// structure
val resp = workSpacesWebClient.createSessionLogger {
eventFilter = EventFilter.Include(listOf<Event>(
Event.fromValue("SessionStart"),
Event.fromValue("SessionEnd"),
Event.fromValue("UrlLoad"),
Event.fromValue("WebsiteInteract")
)
)
logConfiguration = LogConfiguration {
s3 = S3LogConfiguration {
bucket = "my-session-logs-bucket"
keyPrefix = "session-logs/each/event"
bucketOwner = "123456789012"
logFileFormat = LogFileFormat.fromValue("JSONLines")
folderStructure = FolderStructure.fromValue("NestedByDate")
}
}
displayName = "Session Logger with Each Events"
customerManagedKey = "arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012"
additionalEncryptionContext = mapOf<String, String>(
"EncryptionContextKey" to "EncryptionContextValue"
)
tags = listOf<Tag>(
Tag {
key = "KEY-1"
value = "VALUE-1"
},
Tag {
key = "KEY-2"
value = "VALUE-2"
}
)
}
//sampleEnd
}