mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-03 17:39:15 +00:00
Changes the format of log events in the audit logfile. It also changes the filename suffix from `_access` to `_audit`. The new entry format is consistent with Elastic Common Schema. Entries are formatted as JSON with no nested objects and field names have a dotted syntax. Moreover, log entries themselves are not spaced by commas and there is exactly one entry per line. In addition, entry fields are ordered, unlike a typical JSON doc, such that a human would not strain his eyes over jumbled fields from one line to the other; the order is defined in the log4j2 properties file. The implementation utilizes the log4j2's `StringMapMessage`. This means that the application builds the log event as a map and the log4j logic (the appender's layout) handle the format internally. The layout, such as the set of printed fields and their order, can be changed at runtime without restarting the node.
60 lines
2.0 KiB
Groovy
60 lines
2.0 KiB
Groovy
dependencies {
|
|
testCompile "org.elasticsearch.plugin:x-pack-core:${version}"
|
|
}
|
|
|
|
Project mainProject = project
|
|
|
|
group = "${group}.x-pack.qa.sql.security"
|
|
|
|
subprojects {
|
|
// Use resources from the parent project in subprojects
|
|
sourceSets {
|
|
test {
|
|
java {
|
|
srcDirs = ["${mainProject.projectDir}/src/test/java"]
|
|
}
|
|
resources {
|
|
srcDirs = ["${mainProject.projectDir}/src/test/resources"]
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
testCompile "org.elasticsearch.plugin:x-pack-core:${version}"
|
|
}
|
|
|
|
integTestCluster {
|
|
// Setup auditing so we can use it in some tests
|
|
setting 'xpack.security.audit.enabled', 'true'
|
|
setting 'xpack.security.audit.outputs', 'logfile'
|
|
setting 'xpack.security.enabled', 'true'
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
// Setup roles used by tests
|
|
extraConfigFile 'roles.yml', '../roles.yml'
|
|
/* Setup the one admin user that we run the tests as.
|
|
* Tests use "run as" to get different users. */
|
|
setupCommand 'setupUser#test_admin',
|
|
'bin/elasticsearch-users', 'useradd', 'test_admin', '-p', 'x-pack-test-password', '-r', 'superuser'
|
|
// Subprojects override the wait condition to work properly with security
|
|
}
|
|
|
|
integTestRunner {
|
|
systemProperty 'tests.audit.logfile',
|
|
"${ -> integTest.nodes[0].homeDir}/logs/${ -> integTest.nodes[0].clusterName }_audit.log"
|
|
}
|
|
|
|
runqa {
|
|
// Setup auditing so we can use it in some tests
|
|
setting 'xpack.security.audit.enabled', 'true'
|
|
setting 'xpack.security.audit.outputs', 'logfile'
|
|
setting 'xpack.security.enabled', 'true'
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
// Setup roles used by tests
|
|
extraConfigFile 'roles.yml', '../roles.yml'
|
|
/* Setup the one admin user that we run the tests as.
|
|
* Tests use "run as" to get different users. */
|
|
setupCommand 'setupUser#test_admin',
|
|
'bin/elasticsearch-users', 'useradd', 'test_admin', '-p', 'x-pack-test-password', '-r', 'superuser'
|
|
}
|
|
}
|