Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'issue-322-kafka-inputs' into 1.1
- Loading branch information
Showing
5 changed files
with
279 additions
and
5 deletions.
There are no files selected for viewing
89 changes: 89 additions & 0 deletions
89
graylog2-inputs/src/main/java/org/graylog2/inputs/gelf/kafka/GELFKafkaInput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* This file is part of Graylog. | ||
* | ||
* Graylog is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Graylog is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Graylog. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.graylog2.inputs.gelf.kafka; | ||
|
||
import com.codahale.metrics.MetricRegistry; | ||
import com.google.inject.assistedinject.Assisted; | ||
import com.google.inject.assistedinject.AssistedInject; | ||
import org.graylog2.inputs.codecs.GelfCodec; | ||
import org.graylog2.inputs.transports.KafkaTransport; | ||
import org.graylog2.plugin.LocalMetricRegistry; | ||
import org.graylog2.plugin.ServerStatus; | ||
import org.graylog2.plugin.configuration.Configuration; | ||
import org.graylog2.plugin.inputs.MessageInput; | ||
import org.graylog2.plugin.inputs.annotations.ConfigClass; | ||
import org.graylog2.plugin.inputs.annotations.FactoryClass; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class GELFKafkaInput extends MessageInput { | ||
private static final String NAME = "GELF Kafka"; | ||
|
||
@AssistedInject | ||
public GELFKafkaInput(@Assisted Configuration configuration, | ||
MetricRegistry metricRegistry, | ||
KafkaTransport.Factory transport, | ||
GelfCodec.Factory codec, | ||
LocalMetricRegistry localRegistry, | ||
Config config, | ||
Descriptor descriptor, ServerStatus serverStatus) { | ||
this(metricRegistry, | ||
configuration, | ||
transport.create(configuration), | ||
codec.create(configuration), | ||
localRegistry, | ||
config, | ||
descriptor, serverStatus); | ||
} | ||
|
||
protected GELFKafkaInput(MetricRegistry metricRegistry, | ||
Configuration configuration, | ||
KafkaTransport radioKafkaTransport, | ||
GelfCodec codec, | ||
LocalMetricRegistry localRegistry, | ||
MessageInput.Config config, | ||
MessageInput.Descriptor descriptor, ServerStatus serverStatus) { | ||
super(metricRegistry, configuration, radioKafkaTransport, localRegistry, codec, config, descriptor, serverStatus); | ||
} | ||
|
||
@FactoryClass | ||
public interface Factory extends MessageInput.Factory<GELFKafkaInput> { | ||
@Override | ||
GELFKafkaInput create(Configuration configuration); | ||
|
||
@Override | ||
Config getConfig(); | ||
|
||
@Override | ||
Descriptor getDescriptor(); | ||
} | ||
|
||
public static class Descriptor extends MessageInput.Descriptor { | ||
@Inject | ||
public Descriptor() { | ||
super(NAME, false, "https://www.graylog.org/documentation/sending/kafka/"); | ||
} | ||
} | ||
|
||
@ConfigClass | ||
public static class Config extends MessageInput.Config { | ||
@Inject | ||
public Config(KafkaTransport.Factory transport, GelfCodec.Factory codec) { | ||
super(transport.getConfig(), codec.getConfig()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
graylog2-inputs/src/main/java/org/graylog2/inputs/raw/kafka/RawKafkaInput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* This file is part of Graylog. | ||
* | ||
* Graylog is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Graylog is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Graylog. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.graylog2.inputs.raw.kafka; | ||
|
||
import com.codahale.metrics.MetricRegistry; | ||
import com.google.inject.assistedinject.Assisted; | ||
import com.google.inject.assistedinject.AssistedInject; | ||
import org.graylog2.inputs.codecs.RawCodec; | ||
import org.graylog2.inputs.transports.KafkaTransport; | ||
import org.graylog2.plugin.LocalMetricRegistry; | ||
import org.graylog2.plugin.ServerStatus; | ||
import org.graylog2.plugin.configuration.Configuration; | ||
import org.graylog2.plugin.inputs.MessageInput; | ||
import org.graylog2.plugin.inputs.annotations.ConfigClass; | ||
import org.graylog2.plugin.inputs.annotations.FactoryClass; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class RawKafkaInput extends MessageInput { | ||
private static final String NAME = "Raw/Plaintext Kafka"; | ||
|
||
@AssistedInject | ||
public RawKafkaInput(@Assisted Configuration configuration, | ||
MetricRegistry metricRegistry, | ||
KafkaTransport.Factory transport, | ||
RawCodec.Factory codec, | ||
LocalMetricRegistry localRegistry, | ||
Config config, | ||
Descriptor descriptor, ServerStatus serverStatus) { | ||
this(metricRegistry, | ||
configuration, | ||
transport.create(configuration), | ||
codec.create(configuration), | ||
localRegistry, | ||
config, | ||
descriptor, serverStatus); | ||
} | ||
|
||
protected RawKafkaInput(MetricRegistry metricRegistry, | ||
Configuration configuration, | ||
KafkaTransport radioKafkaTransport, | ||
RawCodec codec, | ||
LocalMetricRegistry localRegistry, | ||
MessageInput.Config config, | ||
MessageInput.Descriptor descriptor, ServerStatus serverStatus) { | ||
super(metricRegistry, configuration, radioKafkaTransport, localRegistry, codec, config, descriptor, serverStatus); | ||
} | ||
|
||
@FactoryClass | ||
public interface Factory extends MessageInput.Factory<RawKafkaInput> { | ||
@Override | ||
RawKafkaInput create(Configuration configuration); | ||
|
||
@Override | ||
Config getConfig(); | ||
|
||
@Override | ||
Descriptor getDescriptor(); | ||
} | ||
|
||
public static class Descriptor extends MessageInput.Descriptor { | ||
@Inject | ||
public Descriptor() { | ||
super(NAME, false, "https://www.graylog.org/documentation/sending/kafka/"); | ||
} | ||
} | ||
|
||
@ConfigClass | ||
public static class Config extends MessageInput.Config { | ||
@Inject | ||
public Config(KafkaTransport.Factory transport, RawCodec.Factory codec) { | ||
super(transport.getConfig(), codec.getConfig()); | ||
} | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
graylog2-inputs/src/main/java/org/graylog2/inputs/syslog/kafka/SyslogKafkaInput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* This file is part of Graylog. | ||
* | ||
* Graylog is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Graylog is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Graylog. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.graylog2.inputs.syslog.kafka; | ||
|
||
import com.codahale.metrics.MetricRegistry; | ||
import com.google.inject.assistedinject.Assisted; | ||
import com.google.inject.assistedinject.AssistedInject; | ||
import org.graylog2.inputs.codecs.SyslogCodec; | ||
import org.graylog2.inputs.transports.KafkaTransport; | ||
import org.graylog2.plugin.LocalMetricRegistry; | ||
import org.graylog2.plugin.ServerStatus; | ||
import org.graylog2.plugin.configuration.Configuration; | ||
import org.graylog2.plugin.inputs.MessageInput; | ||
import org.graylog2.plugin.inputs.annotations.ConfigClass; | ||
import org.graylog2.plugin.inputs.annotations.FactoryClass; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class SyslogKafkaInput extends MessageInput { | ||
private static final String NAME = "Syslog Kafka"; | ||
|
||
@AssistedInject | ||
public SyslogKafkaInput(@Assisted Configuration configuration, | ||
MetricRegistry metricRegistry, | ||
KafkaTransport.Factory transport, | ||
SyslogCodec.Factory codec, | ||
LocalMetricRegistry localRegistry, | ||
Config config, | ||
Descriptor descriptor, ServerStatus serverStatus) { | ||
this(metricRegistry, | ||
configuration, | ||
transport.create(configuration), | ||
codec.create(configuration), | ||
localRegistry, | ||
config, | ||
descriptor, serverStatus); | ||
} | ||
|
||
protected SyslogKafkaInput(MetricRegistry metricRegistry, | ||
Configuration configuration, | ||
KafkaTransport radioKafkaTransport, | ||
SyslogCodec codec, | ||
LocalMetricRegistry localRegistry, | ||
MessageInput.Config config, | ||
MessageInput.Descriptor descriptor, ServerStatus serverStatus) { | ||
super(metricRegistry, configuration, radioKafkaTransport, localRegistry, codec, config, descriptor, serverStatus); | ||
} | ||
|
||
@FactoryClass | ||
public interface Factory extends MessageInput.Factory<SyslogKafkaInput> { | ||
@Override | ||
SyslogKafkaInput create(Configuration configuration); | ||
|
||
@Override | ||
Config getConfig(); | ||
|
||
@Override | ||
Descriptor getDescriptor(); | ||
} | ||
|
||
public static class Descriptor extends MessageInput.Descriptor { | ||
@Inject | ||
public Descriptor() { | ||
super(NAME, false, "https://www.graylog.org/documentation/sending/kafka/"); | ||
} | ||
} | ||
|
||
@ConfigClass | ||
public static class Config extends MessageInput.Config { | ||
@Inject | ||
public Config(KafkaTransport.Factory transport, SyslogCodec.Factory codec) { | ||
super(transport.getConfig(), codec.getConfig()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters