There are many statistics that can be gathered for log streams; for the purposes of this recipe and to illustrate the concept, only a single-time series will be dealt with (log volume per minute); however, this should fully illustrate the design and approach for implementing other analyses.
Download and install the
storm-cassandra contrib
project into your Maven repository:git clone https://github.com/quintona/storm-cassandra cd storm-cassandra mvn clean install
Create a new
BaseRichBolt
class calledVolumeCountingBolt
in thestorm.cookbook.log
package. The bolt must declare three output fields:public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields(FIELD_ROW_KEY, FIELD_COLUMN, FIELD_INCREMENT)); }
Then implement a static utility method to derive the minute representation of the log's time:
public static Long getMinuteForTime(Date time) { Calendar c = Calendar.getInstance(); c.setTime...