I have a table in which I store a log of every request to a web site. Every time a page is requested, a record is inserted. I now want to analyze the data in the log to detect possible automated (non-human) requests. The criteria I need to use is x number of requests within y seconds by an individual user.
So, the data looks like this:
| Page | UserId | Date |
| /Page1.htm | 001 | 2014-06-02 11:03 AM |
| /Page2.htm | 001 | 2014-06-02 11:03 AM |
| /Page1.htm | 002 | 2014-06-02 11:04 AM |
| /Page3.htm | 001 | 2014-06-02 11:04 AM |
| /Page2.htm | 002 | 2014-06-02 11:05 AM |
| /Page4.htm | 001 | 2014-06-02 11:05 AM |
| /Page5.htm | 001 | 2014-06-02 11:07 AM |
| /Page3.htm | 002 | 2014-06-02 11:15 AM |
So, I wanted to get all UserIDs that made 5 or more requests within any 5 second timespan. How can I get that? Is this even possible with SQL alone?
I don't have access to the web server logs or anything else other than the SQL Server database.