diff --git a/shield/src/main/java/org/elasticsearch/shield/audit/index/IndexAuditTrail.java b/shield/src/main/java/org/elasticsearch/shield/audit/index/IndexAuditTrail.java index 5c8b158f8c3..8489927d4c4 100644 --- a/shield/src/main/java/org/elasticsearch/shield/audit/index/IndexAuditTrail.java +++ b/shield/src/main/java/org/elasticsearch/shield/audit/index/IndexAuditTrail.java @@ -523,11 +523,7 @@ public class IndexAuditTrail extends AbstractComponent implements AuditTrail, Cl if (indices != null) { msg.builder.array(Field.INDICES, indices); } - - // FIXME WTF!!! Why does this have anything to do with the logger!!!!! - if (logger.isDebugEnabled()) { - msg.builder.field(Field.REQUEST, message.getClass().getSimpleName()); - } + msg.builder.field(Field.REQUEST, message.getClass().getSimpleName()); return msg.end(); } @@ -552,11 +548,7 @@ public class IndexAuditTrail extends AbstractComponent implements AuditTrail, Cl if (indices != null) { msg.builder.array(Field.INDICES, indices); } - - // FIXME WTF!!! Why does this have anything to do with the logger!!!!! - if (logger.isDebugEnabled()) { - msg.builder.field(Field.REQUEST, message.getClass().getSimpleName()); - } + msg.builder.field(Field.REQUEST, message.getClass().getSimpleName()); return msg.end(); } diff --git a/shield/src/test/java/org/elasticsearch/shield/audit/index/IndexAuditTrailTests.java b/shield/src/test/java/org/elasticsearch/shield/audit/index/IndexAuditTrailTests.java index fc23d8154bb..f50cbcbb57f 100644 --- a/shield/src/test/java/org/elasticsearch/shield/audit/index/IndexAuditTrailTests.java +++ b/shield/src/test/java/org/elasticsearch/shield/audit/index/IndexAuditTrailTests.java @@ -242,6 +242,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { List indices = hit.field("indices").getValues(); assertThat(indices, contains((Object[]) ((IndicesRequest) message).indices())); } + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class) @@ -298,6 +299,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { assertEquals("_principal", hit.field("principal").getValue()); assertEquals("_action", hit.field("action").getValue()); assertEquals("transport", hit.field("origin_type").getValue()); + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test @@ -324,6 +326,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { List indices = hit.field("indices").getValues(); assertThat(indices, contains((Object[]) ((IndicesRequest) message).indices())); } + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class) @@ -419,6 +422,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { List indices = hit.field("indices").getValues(); assertThat(indices, contains((Object[]) ((IndicesRequest)message).indices())); } + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class) @@ -484,6 +488,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { List indices = hit.field("indices").getValues(); assertThat(indices, contains((Object[]) ((IndicesRequest)message).indices())); } + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class) @@ -506,6 +511,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { assertEquals("transport", hit.field("origin_type").getValue()); assertEquals(User.SYSTEM.principal(), hit.field("principal").getValue()); assertEquals("internal:_action", hit.field("action").getValue()); + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class) @@ -546,6 +552,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { List indices = hit.field("indices").getValues(); assertThat(indices, contains((Object[]) ((IndicesRequest)message).indices())); } + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class) @@ -582,6 +589,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { assertEquals("_username", hit.field("principal").getValue()); } assertEquals("_action", hit.field("action").getValue()); + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class) @@ -656,6 +664,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { assertThat((String) hit.field("principal").getValue(), is("_username")); assertThat((String) hit.field("run_as_principal").getValue(), is("running as")); assertEquals("_action", hit.field("action").getValue()); + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class) @@ -680,6 +689,7 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase { assertThat((String) hit.field("principal").getValue(), is("_username")); assertThat((String) hit.field("run_as_principal").getValue(), is("running as")); assertEquals("_action", hit.field("action").getValue()); + assertEquals(hit.field("request").getValue(), message.getClass().getSimpleName()); } @Test(expected = IndexNotFoundException.class)