Skip to main content

Last Login Time for a user

  • October 12, 2015
  • 2 replies
  • 17 views

Aadu

Hi,

 

I need to find the last login date and time for a user in Vertica Database. Need help on how to do it. I tried using tables like user_Sesssion, session and dc_session_starts, but the older data seems to get flushed after sometime. How can I get the last login date for a user ? I am using Vertica 7.1.2 version.

 

Regards

Aadu

 

 

2 replies

Adrian_Oprea_1
Forum|alt.badge.img+1
  • Participating Frequently
  • October 12, 2015

 You can increase your retention policy of the dc table.(but watch the space used).

SELECT get_data_collector_policy('SessionEnds');
get_data_collector_policy
-------------------------------------------------------------------------
100KB kept in memory, 5000KB kept on disk. Time based retention disabled.


SELECT set_data_collector_time_policy('SessionEnds', '7 day'::interval);
set_data_collector_time_policy
------------------------------
SET


SELECT get_data_collector_policy('SessionEnds');
get_data_collector_policy
---------------------------------------------------------------
100KB kept in memory, 5000KB kept on disk. 7 days kept on disk.

 

Or you can query your vertica.log for the user connection:

cat vertica.log|grep "Connection authenticated:" | grep username

- you will need to do in all nodes to get the latest.


Aadu
  • Author
  • New Participant
  • October 14, 2015

Thanks Adrian. 

This helps me completely.

 

Regards

Aadu