@Nullable
    @Override
    public Message decode(@Nonnull RawMessage rawMessage) {
        final byte[] payload = rawMessage.getPayload();
        final JsonNode event;
        try {
            event = objectMapper.readTree(payload);
            if (event == null || event.isMissingNode()) {
                throw new IOException("null result");
            }
        } catch (IOException e) {
            LOG.error("Couldn't decode raw message {}", rawMessage);
            return null;
        }

        return parseEvent(event);
    }
@Test
    public void decodeMessagesHandlesWinlogbeatv7Messages() throws Exception {
        final Message message = codec.decode(messageFromJson("winlogbeat-v7.json"));
        assertThat(message).isNotNull();
        assertThat(message.getSource()).isEqualTo("example.local");
        assertThat(message.getTimestamp()).isEqualTo(new DateTime(2016, 11, 24, 12, 13, DateTimeZone.UTC));
        assertThat(message.getField("beats_type")).isEqualTo("winlogbeat");
        assertThat(message.getField("winlogbeat_winlog_level")).isEqualTo("Information");
        assertThat(message.getField("winlogbeat_winlog_event_id")).isEqualTo(5024);
        assertThat(message.getField("winlogbeat_winlog_process_id")).isEqualTo(500);
        assertThat(message.getField("winlogbeat_winlog_log_name")).isEqualTo("Security");
    }