Tracking access by users

In the FileMaker apps I’ve been building for years, I always include a table (usually called something like Accesses) that logs every user access to the database. So I know

  • who logged in
  • when
  • from what IP address
  • what OS they’re using

This has at least two uses: It might help an investigator if there were a criminal breach of the app. (Touch wood: that’s never happened.) The other use that I make of this table on a fairly regular basis is checking to see how much the app is being used, and by whom.

Is it possible to get this info in Knack?

And almost equally important, is it possible to get this info without having to create a record for every access? In FileMaker I have no record limits. (There are other limits to worry about.) But of course in Knack I don’t want to proliferate records recklessly.

One thought that occurred to me is that I could perhaps use Make or Zapier to create a record in Airtable each time a user logs in. Is that possible? Is there a smarter way?

Not a Knack feature, possible with code :man_technologist:

Thanks for quick reply, Carl. Didn’t expect to get a response on a Saturday (and evening where you are, too).

Do you think it could be done with Zapier or Make? I haven’t started to play with integrations yet and I’m not sure how you’d trigger something like this. May put this off until later. NEVER MIND. Looked at the Zapier/Knack integration options and this doesn’t look promising. Will worry about this later.

(Incidentally, it’s not a built-in FileMaker feature either. Just something that is possible with some scripting.)

I use Integromat (Make) quite a bit so think I’m right stating that, even if you can capture the login event data, you’d still have to create a record in Knack. You’d then need to connect to Makes webhook to start the scenario to push it into another service like Airtable or Google sheets etc

You could then circle back and delete the Knack record. However, I’m not sure how you could capture the event of a user logging into the live app. Certainly not a no code solution that I’m aware of.

I’m sure someone can code it, just not me :laughing:

PS…yes, on the forum Saturday evening at 10:30pm U.K. :man_shrugging: - I need to get out more!

Possible using only JavaScript I think. But records history is available. Also maybe knack also saving that somewhere.

Regards,
Sunny Singla

Thanks, Sunny. Not an urgent issue for me now but might become one and I already had it in back of my mind to contact you and ask about possibility of doing this with JavaScript. I guess what I’d want to do is create a record in Airtable or GoogleSheets for each login. But I’ll worry about it later.

Must say I’m a little disappointed this isn’t built-in. It is with Tadabase (not by default, but as an option). And at least for some of the apps I’ve built in the past it’s pretty useful.

Anyway thanks for confirming that there may yet be a solution here.

2 Likes

I set up something with code that I found a long time ago and have since forgotten where I found it. I did find this which looks very similar to the code I’m using. (I’m not a coder so there is probably a developer somewhere shaking his head at that comment). This looks more simplistic than what you’re looking for but might be helpful.

THANK YOU John. Those instructions look like I can follow them. I’m going to give this a try and will report back. Thanks for the link.

(fingers crossed…)

I wrote a blog post about this a while ago which should give you a solution (which you can build on)…

Hope this is useful.

Thanks for that link, too, Julian.

I took the code from your earlier link, updated it for my app (app ID, api key, object and field ids). Read it through carefully and it LOOKS all right. Pasted into the app where you said to put it, saved, refreshed the page. Then logged into the app and out. Have done this a number of times. No records are getting created in the log object.

Not sure what I’m doing wrong. Do I need to have an actual PAGE created for this object?

I see this is going to create records and I’m not excited about that but I can manage that if I can just get a preliminary record of who gets in and when.

BTW I noticed, in a response to your blog post (second link) that a user named Tony mentioned using transparent pixels to log users. I wonder how THAT would work. Been a very long time since I’ve heard anybody mention transparent pixels. :slight_smile:

Hi

I don’t know anything about transparent pixels I’m afraid…

To make the code work, you will need a page to use to input the audit trail data because the code uses view based js. Setting this up is covered in the section “Create a Page to view Log records with an Add Option” in the article.

I hope this helps - if not, post your code here and I will have a look.