Examples of SyslogServerEventIF


Examples of org.graylog2.syslog4j.server.SyslogServerEventIF

         *
         *  http://open.spotify.com/track/2ZtQKBB8wDTtPPqDZhy7xZ
         *
         */

        final SyslogServerEventIF e;
        if (STRUCTURED_SYSLOG_PATTERN.matcher(msg).matches()) {
            e = new StructuredSyslogServerEvent(msg, remoteAddress);
        } else {
            e = new SyslogServerEvent(msg, remoteAddress);

        }

        final Message m = new Message(e.getMessage(), parseHost(e, remoteAddress), parseDate(e, receivedTimestamp));
        m.addField("facility", Tools.syslogFacilityToReadable(e.getFacility()));
        m.addField("level", e.getLevel());

        // Store full message if configured.
        if (configuration.getBoolean(CK_STORE_FULL_MESSAGE)) {
            m.addField("full_message", new String(e.getRaw(), StandardCharsets.UTF_8));
        }


        final boolean expandStructuredData = configuration.getBoolean(CK_EXPAND_STRUCTURED_DATA);
        m.addFields(parseAdditionalData(e, expandStructuredData));
View Full Code Here

Examples of org.productivity.java.syslog4j.server.SyslogServerEventIF

     * Parses {@link Rfc5424SyslogEvent} instance from given raw message bytes and sends it to event handlers.
     *
     * @param rawMsg
     */
    private void handleSyslogMessage(final byte[] rawMsg) {
        final SyslogServerEventIF event = new Rfc5424SyslogEvent(rawMsg, 0, rawMsg.length);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Firing Syslog event: " + event);
        }
        final List eventHandlers = this.server.getConfig().getEventHandlers();
        for (int i = 0; i < eventHandlers.size(); i++) {
View Full Code Here

Examples of org.productivity.java.syslog4j.server.SyslogServerEventIF

        while (!this.shutdown) {
            try {
                final DatagramPacket dp = new DatagramPacket(receiveData, receiveData.length);
                this.ds.receive(dp);
                final SyslogServerEventIF event = new Rfc5424SyslogEvent(receiveData, dp.getOffset(), dp.getLength());
                List list = this.syslogServerConfig.getEventHandlers();
                for (int i = 0; i < list.size(); i++) {
                    SyslogServerEventHandlerIF eventHandler = (SyslogServerEventHandlerIF) list.get(i);
                    eventHandler.event(this, event);
                }
View Full Code Here

Examples of org.productivity.java.syslog4j.server.SyslogServerEventIF

        queue.clear();
        makeLogs(deployementUrl);
        for (Level level : LoggingServlet.LOG_LEVELS) {
            testLog(level);
        }
        final SyslogServerEventIF expectNoOtherMsg = queue.poll(3 * ADJUSTED_SECOND, TimeUnit.MILLISECONDS);
        Assert.assertNull("No other message was expected in syslog.", expectNoOtherMsg);
    }
View Full Code Here

Examples of org.productivity.java.syslog4j.server.SyslogServerEventIF

        setSyslogAttribute("level", "ERROR");
        queue.clear();
        makeLogs(deployementUrl);
        testLog(Level.ERROR);
        testLog(Level.FATAL);
        final SyslogServerEventIF expectNoOtherMsg = queue.poll(3 * ADJUSTED_SECOND, TimeUnit.MILLISECONDS);
        Assert.assertNull("No other message was expected in syslog.", expectNoOtherMsg);
    }
View Full Code Here

Examples of org.productivity.java.syslog4j.server.SyslogServerEventIF

        setSyslogAttribute("level", "TRACE");
        setSyslogAttribute(ENABLED, "false");
        queue.clear();
        try {
            makeLogs(deployementUrl);
            final SyslogServerEventIF expetNoMsg = queue.poll(5 * ADJUSTED_SECOND, TimeUnit.MILLISECONDS);
            Assert.assertNull("No syslog message expected.", expetNoMsg);
        } finally {
            setSyslogAttribute(ENABLED, "true");
        }
    }
View Full Code Here

Examples of org.productivity.java.syslog4j.server.SyslogServerEventIF

     *
     * @param expectedLevel
     * @throws Exception
     */
    private void testLog(final Logger.Level expectedLevel) throws Exception {
        SyslogServerEventIF log = BlockedSyslogServerEventHandler.getQueue().poll(15 * ADJUSTED_SECOND, TimeUnit.MILLISECONDS);
        assertNotNull(log);
        assertEquals("Message with unexpected Syslog event level received.", getSyslogLevel(expectedLevel), log.getLevel());
        final String expectedMsg = MessageFormat.format(LoggingServlet.MSG_TEMPLATE, LoggingServlet.getPrefix(LOG_PREFIX),
                LoggingServlet.getLevelStr(expectedLevel));
        String msg = log.getMessage();
        assertEquals("Message with unexpected Syslog event text received.", expectedMsg, msg);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.