public class SyslogUdpOutput
extends org.thales.punch.libraries.storm.api.BaseProcessingNode
The SyslogBolt can forward the data either forwards the input (storm) tuple transformed as a String. On the PunchPlatform, that means a String representation of a Json document of the form :
{ "storm stream id" : { "storm field id 1" : { "key : value ...}, "storm field id 2" : { "key : value ...} , ...}
For example on a log management PunchPlatform you have something like :
{ "logs" : { "log" : { "message" : "original log" , "vendor" : "apache" ...}}
Often what you need is to forward another format, and/or to filter out some unnecessary fields.
To do that you must insert a PunchBolt before this SyslogBolt. For example here is a punchlet that transform the (Json)
log into a plain key-value string:
{
// get the Json under the stream and field id.
Tuple input = root:[logs][log];
// transform it into a key value string
String kv = toKv().on(input);
// replace the input document by that String.
root:[logs][log] = kv;
}
With such a punchlet, the bolt will send something like
"message"="original log", "vendor"="apache" ...
{
"type" : "syslog_bolt",
"bolt_settings" : {
"destination" : [
{ "host" : "127.0.0.1", "port" : 8888 }
]
},
"storm_settings" : {
"executors": 1
}
}
property | mandatory | type | default | comment |
---|---|---|---|---|
host | yes | string | - | The server host address. Accepted values are dotted number IP addresses, or hostname. You can set several destination addresses using the destination property. |
port | yes | int | - | The server listening port. |
Constructor and Description |
---|
SyslogUdpOutput(org.thales.punch.libraries.storm.api.NodeSettings config)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
declareOutputFields(org.apache.storm.topology.OutputFieldsDeclarer declarer) |
void |
prepare(Map map,
org.apache.storm.task.TopologyContext topologyContext,
org.apache.storm.task.OutputCollector collector)
Setup this spout before starting emitting Tuples into the topology.
|
void |
process(org.apache.storm.tuple.Tuple tuple)
The Syslog bolt expects a single field, and forwards that field to the destination.
|
public SyslogUdpOutput(org.thales.punch.libraries.storm.api.NodeSettings config)
config
- the configpublic void prepare(Map map, org.apache.storm.task.TopologyContext topologyContext, org.apache.storm.task.OutputCollector collector)
prepare
in interface org.apache.storm.task.IBolt
prepare
in class org.thales.punch.libraries.storm.api.BaseProcessingNode
map
- the storm settingstopologyContext
- the topology settingsscollector
- the output collector for sending out tuples.public void process(org.apache.storm.tuple.Tuple tuple)
process
in class org.thales.punch.libraries.storm.api.BaseProcessingNode
tuple
- the tuple to sendpublic void declareOutputFields(org.apache.storm.topology.OutputFieldsDeclarer declarer)
declareOutputFields
in interface org.apache.storm.topology.IComponent
declareOutputFields
in class org.thales.punch.libraries.storm.api.BaseProcessingNode
Copyright © 2022. All rights reserved.