简体   繁体   中英

How to get last access time of application in WebSphere Liberty Server 19.0.0.11

Am developing application in Java 8, JSF, Maven. Build application as war and deploying it in WebSphere Liberty Server 19.0.0.11. I got requirement to get application last access time.? Is there any way to get this detail.?

One way you could do that is by watching the vendor_servlet_request_total metric (provided by the mpMetrics-2.x feature). There is a separately labeled time series for each servlet (a time series is a sequence of metric values in chronological order) -- by periodically polling the /metrics endpoint, and totalling the values across all servlets you would be able to tell when traffic has stopped.

10:17am

vendor_servlet_request_total{servlet=MyServletA} 100
vendor_servlet_request_total{servlet=MyServletB} 205

10:18am

vendor_servlet_request_total{servlet=MyServletA} 102
vendor_servlet_request_total{servlet=MyServletB} 209

10:19am

vendor_servlet_request_total{servlet=MyServletA} 102
vendor_servlet_request_total{servlet=MyServletB} 209

In the example above, since the servlet request counts didn't change between 10:18am and 10:19am you can conclude that the last access was before 10:18am.

see https://openliberty.io/docs/ref/general/#metrics-catalog.html for more detail on the available metrics from mpMetrics-2.x.

您可能会编写一个过滤器来拦截对应用程序的所有请求并更新保存上次访问的变量,或者如果您要查询,则返回该变量值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM