Search in sources :

Example 66 with MessageInput

use of org.graylog2.plugin.inputs.MessageInput in project graylog2-server by Graylog2.

the class MessageInputBindings method configure.

@Override
protected void configure() {
    install(new TransportsModule());
    install(new CodecsModule());
    final MapBinder<String, MessageInput.Factory<? extends MessageInput>> inputMapBinder = inputsMapBinder();
    // new style inputs, using transports and codecs
    installInput(inputMapBinder, RawTCPInput.class, RawTCPInput.Factory.class);
    installInput(inputMapBinder, RawUDPInput.class, RawUDPInput.Factory.class);
    installInput(inputMapBinder, RawAMQPInput.class, RawAMQPInput.Factory.class);
    installInput(inputMapBinder, RawKafkaInput.class, RawKafkaInput.Factory.class);
    installInput(inputMapBinder, SyslogTCPInput.class, SyslogTCPInput.Factory.class);
    installInput(inputMapBinder, SyslogUDPInput.class, SyslogUDPInput.Factory.class);
    installInput(inputMapBinder, SyslogAMQPInput.class, SyslogAMQPInput.Factory.class);
    installInput(inputMapBinder, SyslogKafkaInput.class, SyslogKafkaInput.Factory.class);
    installInput(inputMapBinder, FakeHttpMessageInput.class, FakeHttpMessageInput.Factory.class);
    installInput(inputMapBinder, GELFTCPInput.class, GELFTCPInput.Factory.class);
    installInput(inputMapBinder, GELFHttpInput.class, GELFHttpInput.Factory.class);
    installInput(inputMapBinder, GELFUDPInput.class, GELFUDPInput.Factory.class);
    installInput(inputMapBinder, GELFAMQPInput.class, GELFAMQPInput.Factory.class);
    installInput(inputMapBinder, GELFKafkaInput.class, GELFKafkaInput.Factory.class);
    installInput(inputMapBinder, JsonPathInput.class, JsonPathInput.Factory.class);
    install(new BeatsInputPluginModule());
}
Also used : CodecsModule(org.graylog2.inputs.codecs.CodecsModule) SyslogTCPInput(org.graylog2.inputs.syslog.tcp.SyslogTCPInput) GELFKafkaInput(org.graylog2.inputs.gelf.kafka.GELFKafkaInput) JsonPathInput(org.graylog2.inputs.misc.jsonpath.JsonPathInput) BeatsInputPluginModule(org.graylog.plugins.beats.BeatsInputPluginModule) SyslogAMQPInput(org.graylog2.inputs.syslog.amqp.SyslogAMQPInput) GELFAMQPInput(org.graylog2.inputs.gelf.amqp.GELFAMQPInput) SyslogUDPInput(org.graylog2.inputs.syslog.udp.SyslogUDPInput) FakeHttpMessageInput(org.graylog2.inputs.random.FakeHttpMessageInput) MessageInput(org.graylog2.plugin.inputs.MessageInput) GELFHttpInput(org.graylog2.inputs.gelf.http.GELFHttpInput) TransportsModule(org.graylog2.inputs.transports.TransportsModule) GELFTCPInput(org.graylog2.inputs.gelf.tcp.GELFTCPInput) SyslogKafkaInput(org.graylog2.inputs.syslog.kafka.SyslogKafkaInput) RawTCPInput(org.graylog2.inputs.raw.tcp.RawTCPInput) GELFUDPInput(org.graylog2.inputs.gelf.udp.GELFUDPInput) RawAMQPInput(org.graylog2.inputs.raw.amqp.RawAMQPInput) RawKafkaInput(org.graylog2.inputs.raw.kafka.RawKafkaInput) RawUDPInput(org.graylog2.inputs.raw.udp.RawUDPInput) FakeHttpMessageInput(org.graylog2.inputs.random.FakeHttpMessageInput)

Example 67 with MessageInput

use of org.graylog2.plugin.inputs.MessageInput in project graylog2-server by Graylog2.

the class InputLauncher method handleLaunchException.

protected void handleLaunchException(Throwable e, IOState<MessageInput> inputState) {
    final MessageInput input = inputState.getStoppable();
    StringBuilder msg = new StringBuilder("The [" + input.getClass().getCanonicalName() + "] input with ID <" + input.getId() + "> misfired. Reason: ");
    String causeMsg = ExceptionUtils.getRootCauseMessage(e);
    msg.append(causeMsg);
    LOG.error(msg.toString(), e);
    // Clean up.
    // cleanInput(input);
    inputState.setState(IOState.Type.FAILED, causeMsg);
}
Also used : MessageInput(org.graylog2.plugin.inputs.MessageInput)

Example 68 with MessageInput

use of org.graylog2.plugin.inputs.MessageInput in project graylog2-server by Graylog2.

the class InputLauncher method launchAllPersisted.

public void launchAllPersisted() {
    for (MessageInput input : persistedInputs) {
        if (leaderStatusInhibitsLaunch(input)) {
            LOG.info("Not launching 'onlyOnePerCluster' input [{}/{}/{}] because this node is not the leader.", input.getName(), input.getTitle(), input.getId());
            continue;
        }
        if (shouldStartAutomatically(input)) {
            LOG.info("Launching input [{}/{}/{}] - desired state is {}", input.getName(), input.getTitle(), input.getId(), input.getDesiredState());
            input.initialize();
            launch(input);
        } else {
            LOG.info("Not auto-starting input [{}/{}/{}] - desired state is {}", input.getName(), input.getTitle(), input.getId(), input.getDesiredState());
        }
    }
}
Also used : MessageInput(org.graylog2.plugin.inputs.MessageInput)

Example 69 with MessageInput

use of org.graylog2.plugin.inputs.MessageInput in project graylog2-server by Graylog2.

the class MessageInputFactory method create.

public MessageInput create(InputCreateRequest lr, String user, String nodeId) throws NoSuchInputTypeException {
    final MessageInput input = create(lr.type(), new Configuration(lr.configuration()));
    input.setTitle(lr.title());
    input.setGlobal(lr.global());
    input.setCreatorUserId(user);
    input.setCreatedAt(Tools.nowUTC());
    if (!lr.global())
        input.setNodeId(nodeId);
    return input;
}
Also used : Configuration(org.graylog2.plugin.configuration.Configuration) MessageInput(org.graylog2.plugin.inputs.MessageInput)

Aggregations

MessageInput (org.graylog2.plugin.inputs.MessageInput)47 Test (org.junit.Test)18 Callable (java.util.concurrent.Callable)17 NotFoundException (org.graylog2.database.NotFoundException)10 Configuration (org.graylog2.plugin.configuration.Configuration)9 ChannelHandler (io.netty.channel.ChannelHandler)8 LinkedHashMap (java.util.LinkedHashMap)8 Input (org.graylog2.inputs.Input)8 MisfireException (org.graylog2.plugin.inputs.MisfireException)7 ChannelHandler (org.jboss.netty.channel.ChannelHandler)7 Timed (com.codahale.metrics.annotation.Timed)6 ApiOperation (io.swagger.annotations.ApiOperation)6 ApiResponses (io.swagger.annotations.ApiResponses)6 EventBus (com.google.common.eventbus.EventBus)5 AuditEvent (org.graylog2.audit.jersey.AuditEvent)5 Subscribe (com.google.common.eventbus.Subscribe)4 Produces (javax.ws.rs.Produces)4 IOState (org.graylog2.plugin.IOState)4 LocalMetricRegistry (org.graylog2.plugin.LocalMetricRegistry)4 Extractor (org.graylog2.plugin.inputs.Extractor)4