public class AccessLogAnalyzer extends Object
sources
and
sinks
in a job that reads a Web access
log file and counts accesses to particular URL paths. It gives the
results for the whole path hierarchy, i.e., a path a/b/c
increases the count for a
, a/b
and a/b/c
.
The sample demonstrates how to write a simple Traverser
to
implement the flatmapping logic that turns a path into a list of its
subpaths: explodeSubPaths()
.
This analyzer could be run on a Jet cluster deployed on the same
machines as those forming the web server cluster. This way each
instance would analyze the local log files and merge the counts for the
whole cluster. Since the sample uses a file-writing sink, there will be
an output file on each member, containing a slice of the full set of
analyzed paths. If you use an IMap
instead, you'd get all the
data in one place.
The sample log files are in {module.dir}/data/access_log.processed
.
Constructor and Description |
---|
AccessLogAnalyzer() |
public static void main(String[] args)
Copyright © 2020 Hazelcast, Inc.. All rights reserved.