@@ -89,34 +89,59 @@ An example of the configuration files:
8989```
9090
9191## Usage
92- ### Fake Log Generator
93- * Generate apache access log
92+
93+ ### Direct File Import + Mini-Monitor
94+
95+ * Run fake log generator:
96+
97+ ```
98+ python3.4 $VISORHOME/src/fake_log_gen/fake_log_gen.py -m [access/error] -o [logfile]
99+ ```
100+
101+ * Run Mini-Monitor to analyze generated log files:
102+ ```
103+ python3.4 $VISORHOME/src/mini_monitor/mini_monitor.py -i [logfile]
104+ ```
105+
106+ ### TCP Transmission + Spark Streaming
107+
108+ * Generate fake logs and run as TCP server:
109+
94110```
95- python3.4 $Visor_HOME /src/fake_log_gen/fake_log_gen .py -m access -o fake_access_file.log
111+ python3.4 $VISORHOME /src/socket/fake_log_stream .py -m [ access/error]
96112```
97113
98- * Generate apache error log
114+ * Run Spark Streaming application to receive & analyze logs
115+
99116```
100- python3.4 $Visor_HOME /src/fake_log_gen/fake_log_gen .py -m error -o fake_error_file.log
117+ $SPARK_HOME/bin/spark-submit $VISORHOME /src/stream_monitor/stream_monitor .py
101118```
102- ### Mini-Monitor
119+
120+ ### Kafka Streaming + Spark Streaming
121+ * Start a Kafka server:
103122```
104- python3.4 $Visor_HOME/src/mini_monitor/mini_monitor.py -i fake_error_file.log
123+ $KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties
105124```
106125
107- ### TCP Socket Transmission
108- * Stream Apache access log
126+ * Create a Kafka topic:
109127```
110- python3.4 $Visor_HOME/src/socket/fake_log_stream.py -m access
128+ $KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
111129```
112130
113- * Stream apache error log
131+ * Generate fake logs and run as Kafka producer:
114132```
115- python3.4 $Visor_HOME /src/socket/fake_log_stream .py -m error
133+ python3.4 $VISORHOME /src/fake_log_gen/fake_log_producer .py -m [access/ error]
116134```
117135
136+ * Run Spark Streaming application to consume & analyze logs
137+ ```
138+ $SPARK_HOME/bin/spark-submit --packages org.apache.spark:spark-streaming-kafka-0-8_2.11:2.0.0 $VISORHOME/src/kafka_monitor/kafka_monitor.py
139+ ```
140+
141+
118142## Resources
119143* [Apache Log Files](https://httpd.apache.org/docs/1.3/logs.html)
144+ * [Unit Testing TCP Server & Client with Python](http://www.devdungeon.com/content/unit-testing-tcp-server-client-python)
120145
121146## License
122147See the LICENSE file for license rights and limitations (MIT).
0 commit comments