cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Logbook for user login

Logbook for user login

Idzwan
Member

Hi,

Our customer requests a logbook for different user login. Users of different role has different rights/views he can access in the HMI. Hence, user log is required.  Any idea how I can create the log? 

The visualisation is built on WebIQ Version 2.13, on CtrlX Core V1.20

8 REPLIES 8

HmiGuide
Community Moderator
Community Moderator

I'm not sure if I understand your question correct. What I understand is that you want to create a log file which contains the following data:

  • Date/Time
  • User
  • Action (e.g. Read recipe, Login, Logout,...)

1. Is that correct?

Right now there is no build in log feature, but it is on the feature list of WebIQ. I don't know a schedule.

When you need it right now, the only way I see is to implement it by yourself with java scripts.

webiq-sk
Frequent Contributor

This is currently not possible with WebIQ, but audit functionality is currently in development.

A workaround with JavaScript can only be used when ensuring that all users only access the HMI on locked-down systems, i.e. with kiosk-mode browsers. Otherwise the user could simply use the browser's development tools (F12) to disable the JavaScript code that logs the login or even manipulate the user name logged.

Hi, 

yes that is exactly what I am trying to achieve

Hi. Yes, the webbrowser to access the visu will be done in kiosk mode. Do you have an example code of the javascript for this purpose?

webiq-sk
Frequent Contributor

The only thing you can do with WebIQ here is have a LocalScript that s executed when the HMI is loaded (i.e. after the user has logged in).

This LocalScript then reads the user info (shmi.visuals.session.UserManager.getCurrentUser()) and sends it via a HTTP(S) request to another URL that then records it. That "other URL" has to be implemented by you then as it simply receives some data via a URL and shall write it to a log file or a database.

HmiGuide
Community Moderator
Community Moderator

Alternatively to use a webServer saving the log info I see the following alternatives:

  • Send log info to PLC and use PLC functions to write the log into a file.
    But implement a mechanism to limit size of the log file, to avoid that the storage of ctrlX is completely filled after some days, months or years.
  • Use WebIQ alarm handling to store the log info. Use type "information" and create a group "log" for easy filtering.

HmiGuide
Community Moderator
Community Moderator

I attached an WebIQ 2.14.3 example which write log notifications into WebIQ Alarm Manager for:

  • LogIn
  • Change of variable SInt
  • Function call

HmiGuide_0-1697098594730.png

webiq-sk
Frequent Contributor

What this does is the following:
1. It sets an item to the user name that just logged in
2. It then triggers the alarm
3. Whenever someone logs in on any other HMI a new login will be logged as an alarm in addition

This has the following potential issues:
a) If two people login on two different browsers at almost the same time one login user name might not be logged as the context item already has the value of the second user and the first user's login is not logged - instead two logins of the second user will be logged (it's all asynchronous and network latency needs to be considered)
b) If you have the HMI open on multiple browser windows each login will be logged multiple times, once by each open HMI and implicitly with a different timestamp (10 HMIs open = 10 user login logs for a single login) - this can be fixed by simply removing this part of the code as it is not required

This can work if you only have a single system (i.e. browser window).

When using an external tool where you only send the information to this will not happen, because there you send the user name directly and even multiple logins at the same time will be handled (if you tool has been programmed correctly of course).

However, when the user logs in to the server itself using the API this will not be logged in both cases.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist