Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] How can I accurately count visits?

Hi,

On Tue, Aug 10, 2021 at 11:20 PM <gouessej@xxxxxxxxx> wrote:
>
> Hello
>
> I would like to count visits. I use Jetty 11, my logs are in combined log format (I guess from a line produced by a silly script kiddy):
> 209.141.54.8 - - [10/Aug/2021:05:40:17 +0000] "POST /boaform/admin/formLogin HTTP/1.1" 404 451 "http://80.13.94.99:80/admin/login.asp"; "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"
>
> I can't use GoAccess because it counts hits but it doesn't count visits. I can't use AWStats because it seems to count only the visits on the pages, not the direct visits of image files for example. I can't use Matomo because it requires PHP (I don't want to install PHP only to use a single program).
>
> I would like to know whether a request has been caused by a previous request. For example, imagine that index.html refers to img.png. When I go to index.html, it will cause at least 2 hits.

If you never accessed the page, then the request for img.png will have
the `Referer: /index.html` header.
In this way you can know that img.png is a dependent resource of index.html.

Otherwise, likely img.png is cached by the browser and will not be requested.

You can imagine that now you want to specify a window of time for
correlated requests so that you can separate the visits.
Say, if a request with a `Referer` header arrives within 5 seconds
from the request of the primary resource, then it's a correlated
request, otherwise it may be a replay, or a manual request, or a bot,
etc. -- in general something you want to count differently.
That is what we do for the PushCacheFilter, if you want to have a code example.

I'm afraid that you have to write your own code for your own logic.

Or, like Olivier said, rely on some web analytics tool (and take care of GDPR).

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top