Search in sources :

Example 1 with SyslogProtocol

use of org.opennms.netmgt.alarmd.northbounder.syslog.SyslogDestination.SyslogProtocol in project opennms by OpenNMS.

the class SyslogUtils method createNorthboundInstance.

/**
     * Creates the northbound instance.
     *
     * @param destination the destination
     * @throws SyslogRuntimeException the syslog runtime exception
     */
public static void createNorthboundInstance(SyslogDestination destination) throws SyslogRuntimeException {
    LOG.info("Creating Syslog Northbound Instance {}", destination.getName());
    int facility = convertFacility(destination.getFacility());
    SyslogProtocol protocol = destination.getProtocol();
    SyslogConfigIF instanceConfiguration = createConfig(destination, protocol, facility);
    instanceConfiguration.setIdent("OpenNMS");
    instanceConfiguration.setCharSet(destination.getCharSet());
    instanceConfiguration.setMaxMessageLength(destination.getMaxMessageLength());
    instanceConfiguration.setSendLocalName(destination.isSendLocalName());
    instanceConfiguration.setSendLocalTimestamp(destination.isSendLocalTime());
    instanceConfiguration.setTruncateMessage(destination.isTruncateMessage());
    instanceConfiguration.setUseStructuredData(SyslogConstants.USE_STRUCTURED_DATA_DEFAULT);
    try {
        Syslog.createInstance(destination.getName(), instanceConfiguration);
    } catch (SyslogRuntimeException e) {
        LOG.error("Could not create northbound instance, '{}': {}", destination.getName(), e);
        throw e;
    }
}
Also used : SyslogConfigIF(org.graylog2.syslog4j.SyslogConfigIF) SyslogRuntimeException(org.graylog2.syslog4j.SyslogRuntimeException) SyslogProtocol(org.opennms.netmgt.alarmd.northbounder.syslog.SyslogDestination.SyslogProtocol)

Aggregations

SyslogConfigIF (org.graylog2.syslog4j.SyslogConfigIF)1 SyslogRuntimeException (org.graylog2.syslog4j.SyslogRuntimeException)1 SyslogProtocol (org.opennms.netmgt.alarmd.northbounder.syslog.SyslogDestination.SyslogProtocol)1