use of org.graylog2.system.activities.SystemMessage in project graylog2-server by Graylog2.
the class MessagesResource method all.
@GET
@Timed
@ApiOperation(value = "Get internal Graylog system messages")
@RequiresPermissions(RestPermissions.SYSTEMMESSAGES_READ)
@Produces(MediaType.APPLICATION_JSON)
public Map<String, Object> all(@ApiParam(name = "page", value = "Page") @QueryParam("page") int page) {
final List<Map<String, Object>> messages = Lists.newArrayList();
for (SystemMessage sm : systemMessageService.all(page(page))) {
Map<String, Object> message = Maps.newHashMapWithExpectedSize(4);
message.put("caller", sm.getCaller());
message.put("content", sm.getContent());
message.put("timestamp", Tools.getISO8601String(sm.getTimestamp()));
message.put("node_id", sm.getNodeId());
messages.add(message);
}
return ImmutableMap.of("messages", messages, "total", systemMessageService.totalCount());
}
Aggregations