/distributed-logging

This repository can be used to log files located across a distributed system with multiple virtual machines. A grep command needs to be entered at any client on a particular machine, and it will print out the output on the terminal. Regex queries are supported as well.

Primary LanguageC++

Distributed Logging

This repository can be used to log files located across a distributed system with multiple virtual machines. A grep command needs to be entered at any client on a particular machine, and it will print out the output on the terminal. Regex queries are supported as well.

Setup (run on each VM):

  1. Download log files and compile server.cpp and client.cpp: bash setup_vm.sh
  2. Start the server: ./server.out i, where i is the corresponding machine (VM) number

Now, start the client on any machine of your choice, say machine k. Run ./client.out k You will see a terminal prompt > where you can enter any grep commands. Enter commands in the format grep XYZ, without any quotes around the desired expression.

For Unit Testing:

  1. Repeat steps 1-4 above.
  2. Copy log files to testing directory: cp -r "MP1 Demo Data FA22" "../test/MP1 Demo Data FA22"
  3. Make sure the log files in ./test/MP1 Demo Data FA22 are for the machines that are acting as a server. If machine 1, 2 and 3 are being used as a server, then the directory shoud only have vm1.log, vm2.log and vm3.log.
  4. cd test
  5. g++ -o client_test.out client_test.cpp
  6. ./client_test.out. The program will print out the ground truth grep output for a pattern as well as the one generated by our distributed program, and finally report whether the unit test passed or failed. The pattern that need to be search is stored in L96, variable pattern.