Hi everyone, this is for sercurity need, I wonder if SambaPOS has User Login log function? I think it is a good pratice for admin to know when, where & who login-ed into SambaPOS.
Its not built in but you could use User Logged In rule event to capture that perhaps the save to file action to create a log.
Hello kendash, thank you very much for replying my topic. Is it possible to give me a bit more detail? I’m bad at these Rule-Action stuff.
I would upload it to a web server into a database, I could give you a tutorial on how to do this if you would like?
The benifits would be that you would be able to view a table which shows a log of users loging/loggin out
Yeah! Thank you so much, I can’t wait to put my hand on you tutorial. Thanks alot. ^o^
First up could I ask, do you have a website to upload the file too? That way you would be able to access the logs remotely from your phone etc…
Yes, I can access my host and database freely.
Ok so oyu would be happy to upload some PHP Scripts to your website?
No, sadly, the system can’t do that. My MSSQL running local on a Windows machine. Meanwhile, our website is running on a 3rd party service. They are seperated. I also don’t want to mess up my server with PHP and stuff. It should be better using kendash’s method with Action-Rule or Report function inside SambaPOS. I’m sorry.
Another method is using some advanced features of v5.1.60 to create tasks containing log data and using custom reports to report on those tasks. GraphQL could be used to build a web app that can be used to view reports from anywhere including a web browser on a phone.
Those sound luxury for me. I guess, I’ll keep waiting until an easy to implement solution appear on the forum. Thank you for taking time digging into this topic.
#Method 1: Log to Text File
##Create Action for Add Line to Text File
##UL Add line to Logfile
[Add Line To Text File]
(Action)##
Action Name: | UL Add line to Logfile |
Action Type: | Add Line To Text File |
File Path: | [:filePath] |
Text: | [:content] |
##Create Rule for User Login
event:
##UL User Login
[User Logged In]
(Rule)##
Rule Name: | UL User Login |
Event Name: | User Logged In |
Rule Tags: |
|
Execute Rule if: | Matches |
##Actions (1):##
UL Add line to Logfile
Constraint: (none)
filePath: | D:/Programs/POS/logs/userlog.txt |
content: | {DATE:yyyy-MM-dd hh:mm:ss} USER LOGIN: [:UserName] |
##Mappings##
Mappings
Terminal | User Role | Department | Ticket Type |
* | * | * | * |
##Create Rule for User Logout
event:
##UL User Logout
[User Logged Out]
(Rule)##
Rule Name: | UL User Logout |
Event Name: | User Logged Out |
Rule Tags: |
|
Execute Rule if: | Matches |
##Actions (1):##
UL Add line to Logfile
Constraint: (none)
filePath: | D:/Programs/POS/logs/userlog.txt |
content: | {DATE:yyyy-MM-dd hh:mm:ss} USER LOGOUT: [:UserName] |
##Mappings##
Mappings
Terminal | User Role | Department | Ticket Type |
|
|
|
|
##Open your Text File
#Method 2: Log using Tasks
##Create a Task Type
##Create Action for Add Task
##UL Add Task
[Add Task]
(Action)##
Action Name: | UL Add Task |
Action Type: | Add Task |
Task Type Name: | UL User Log |
Name: | [:taskName] |
Content: | [:taskContent] |
Custom Fields: | [:customData] |
##Create Rule for User Login
##UL User Login
[User Logged In]
(Rule)##
Rule Name: | UL User Login |
Event Name: | User Logged In |
Rule Tags: |
|
Execute Rule if: | Matches |
##Actions (1):##
UL Add Task
Constraint: (none)
taskName: | UL User Log |
taskContent: | {DATE:yyyy-MM-dd hh:mm:ss} USER LOGIN: [:UserName] |
customData: | date={DATE:yyyy-MM-dd},time={DATE:hh:mm:ss},action=UserLogin,userName=[:UserName] |
##Mappings##
Mappings
Terminal | User Role | Department | Ticket Type |
|
|
|
|
##Create Rule for User Logout
##UL User Logout
[User Logged Out]
(Rule)##
Rule Name: | UL User Logout |
Event Name: | User Logged Out |
Rule Tags: |
|
Execute Rule if: | Matches |
##Actions (1):##
UL Add Task
Constraint: (none)
taskName: | UL User Log |
taskContent: | {DATE:yyyy-MM-dd hh:mm:ss} USER LOGOUT: [:UserName] |
customData: | date={DATE:yyyy-MM-dd},time={DATE:hh:mm:ss},action=UserLogout,userName=[:UserName] |
##Mappings##
Mappings
Terminal | User Role | Department | Ticket Type |
|
|
|
|
##Create a Report
##UL User Log
[0]
(Report)##
Report Name: | UL User Log |
Page Size: | 17cm |
Display in Report Explorer: | checked |
Visual Printing: | unchecked |
Template:
[User Log: 1, 1,1,1,3]
>Date|Time|User|Action|Task
{REPORT TASK DETAILS:T.StartDate,T.StartTime,TSC.userName,TSC.action,T.ContentText:(TST=UL User Log)}
##Look at your Report
I showed how to log WHEN and WHO Logged In or Logged Out.
You can also make as part of the logging, the WHERE using the Terminal Name via the Tag {:CURRENTTERMINAL}
For example, using the Task method:
taskContent:
{DATE:yyyy-MM-dd hh:mm:ss} USER LOGIN: [:UserName] Terminal: {:CURRENTTERMINAL}
customData:
date={DATE:yyyy-MM-dd},time={DATE:hh:mm:ss},action=Login,userName=[:UserName],terminal={:CURRENTTERMINAL}
… and then your Report becomes:
[User Log: 1, 1,1,1,1,3]
>Date|Time|Terminal|User|Action|Task
{REPORT TASK DETAILS:T.StartDate,T.StartTime,TSC.terminal,TSC.userName,TSC.action,T.ContentText:(TST=UL User Log)}