Create a simple console program that monitors HTTP traffic on your machine:
- Consume an actively written-to w3c-formatted HTTP access log (https://en.wikipedia.org/wiki/Common_Log_Format)
- Every 10s, display in the console the sections of the web site with the most hits (a section is defined as being what's before the second '/' in a URL. i.e. the section for "http://my.site.com/pages/create' is "http://my.site.com/pages"), as well as interesting summary statistics on the traffic as a whole.
- Make sure a user can keep the console app running and monitor traffic on their machine
- Whenever total traffic for the past 2 minutes exceeds a certain number on average, add a message saying that “High traffic generated an alert - hits = {value}, triggered at {time}”
- Whenever the total traffic drops again below that value on average for the past 2 minutes, add another message detailing when the alert recovered
- Make sure all messages showing when alerting thresholds are crossed remain visible on the page for historical reasons.
- Write a test for the alerting logic
- Explain how you’d improve on this application design
If you get an error related with restoring nuget packages running one of the powershell commands below, please do the following:
- Open Solution on Visual Studio
- Right-Click on the solution.
- Restore NuGet Packages.
If by any chance the powerhsell commands below still don't work, please do the following:
- Open Solution on Visual Studio.
- Right-Click on the solution.
- Manage NuGet Packages for Solution.
- Select Updates tab
- Select all packages
- Update
The powershell commands below should now work.
- Please make sure you have Visual Studio 2017 Community version installed on your computer.
- Open a Windows Powershell and navigate to the project Powershell folder.
- Run
.\Build.ps1
- Navigate to the project's bin\Release folder
- Run
.\LogMonitor.exe [-t threshold] -g
Ex: .\LogMonitor.exe -t 1000 -g
- Please make sure you have Visual Studio 2017 Community version installed on your computer.
- Open a Windows Powershell and navigate to the project Powershell folder.
- Run
.\Build.ps1
- Navigate to the project's bin\Release folder
- Run
.\LogMonitor.exe [-t threshold] -f generated.txt
Ex: .\LogMonitor.exe -t 1000 -f generated.txt
- Please make sure you have Visual Studio 2017 Community version installed on your computer.
- Open a Windows Powershell and navigate to the project Powershell folder.
- Run
.\Build.ps1
.\Test.ps1
To stop the execution at any time click Ctrl + C.
- Possibility to read from more than 1 log file at the same time.
- Arguments validation is not working properly. The user can input a log to monitor and ask to generate a log. Only the latter one will be done.
- When two or more arguments are not valid, the corresponding number of errors should be shown and not only the first one.
- Possibility to parse the log from a supplied path instead of only from the examples folder.
- Possibility to write the resulting log to a supplied path instead of only to the results folder.
- Should be possible to generate a log file without the need to specify the threshold.
- Components like Notification, Timer and Logger should be testable.
- Use dependency injection (Autofac).
- Powershell build command should also restore NuGet packages.