Re: Grouping logs by ip and time

Поиск
Список
Период
Сортировка
Искать
От
Ascarabina
Тема
Re: Grouping logs by ip and time
Дата
Msg-id
4EB97C5D.6030800@gmail.com
Ответ на
Список
Дерево обсуждения
Grouping logs by ip and time Alex Thurlow <alex-reports@blastro.com>
Re: Grouping logs by ip and time Raymond O'Donnell <rod@iol.ie>
Re: Grouping logs by ip and time Raymond O'Donnell <rod@iol.ie>
Re: Grouping logs by ip and time John R Pierce <pierce@hogranch.com>
Re: Grouping logs by ip and time Ascarabina <ascarabina@gmail.com>
Re: Grouping logs by ip and time Alex Thurlow <alex-reports@blastro.com>
Re: Grouping logs by ip and time Thomas Markus <t.markus@proventis.net>
> Would something like this work? -
>
>    select ip, max("time") - min("time") as session_duration
>    from log_table
>    group by ip;

I don't think this is the right way to do. This is based on ip address, 
so if
- client connect diffrent times with same ip
- client has sime ip but he made another action on other day.
you will have a wrong results.


You should save also the session id and group by sesion id not ip.
Ex. :
Table
------------------
log_type text,
date date,
"time" time without time zone,
ip inet session_id text -- you can use maybe foreign tables ?

SQL  ( Same as Raynold's but groups session ids)
-------------------
  select ip, max("time") - min("time") as session_duration
  from log_table
  group by session_id;
В списке pgsql-general по дате отправления
От: John R Pierce
Дата:
От: Alex Thurlow
Дата:
FAQ