Log storage: Logstore xAPI

Maintained by Picture of jerrett fowler jerrett fowler, Picture of Ryan Smith Ryan Smith
Logstore_xapi is a logstore plugin which emits xAPI statements (also known as Tin Can) to an LRS of your choice.
221 sites
14 fans

What does it do?

As stated on the Github repository, the plugin simply “emits events from the Moodle Logstore as xAPI or TinCan statements”. For those that don’t know, the Moodle Logstore is a log of activities in Moodle. When you view a course, complete a quiz, or grade a student a log of that activity is recorded in the Logstore. The plugin uses these logs to produce xAPI/TinCan statements and then sends (emits) them to an LRS (Learning Record Store) that you can configure.

How does it work?

The plugin is made up of three parts, an Expander, a Translator, and an Emitter. Every log entry goes through each of these parts in a six step process before finally reaching the LRS (see below).

  1. The plugin passes the log entry from the logstore_standard_log to the Expander.

  2. The Expander expands the log entry with data from your Moodle database.

  3. The plugin passes the expanded event from step 2 to the Translator.

  4. The Translator translates the expanded event to xAPI/TinCan recipe options.

  5. The plugin passes the translated event from step 4 to the Emitter.

  6. The Emitter constructs the translated event as an xAPI/TinCan statement and emits it to the LRS.

Potential privacy issues

This system sends logging information over the internet. This would include information about the user, links to their profile, and information of courses completed. It would be recommended to have a secure connection between your website and LRS if they are not within a private network.


Screenshot #0


Picture of jerrett fowler
jerrett fowler (Lead maintainer)
Picture of Ryan Smith
Ryan Smith: Developer
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of jerrett fowler
    Wed, 22 Jul 2015, 9:21 PM
    This is awesome! Thank you.
  • Picture of Michael Aherne
    Wed, 9 Sep 2015, 6:52 PM
    Really cool plugin, guys! Do you know of anyone who is using it in production? I must admit I'd be a little worried about installing it on a production service since it's making blocking HTTP requests on key pages like course view and login, so the performance and stability of the Moodle service would be tied to that of the LRS. Would be really interested to hear how people are dealing with that!
  • Picture of Artem Nychyporchuk
    Thu, 1 Oct 2015, 1:25 AM
    Hi. I've installed this plugin, entered endpoint, username and password of demo learninglocker. Then I enabled plugin, logged on website and tried to do some events in moodle(log in, log out, etc.), but there was nothing on the Statement page. What can i do to fix this?
  • Picture of jerrett fowler
    Thu, 1 Oct 2015, 4:40 PM
    Hello Artem, could you please log any issues at: https://github.com/jlowe64/moodle-logstore_xapi

    Also, you will need to provide more information about your setup. Such as, what LRS are you using, what did you put into the fields for setup? Just anything that'll help.
  • Picture of lee kirkland
    Fri, 9 Oct 2015, 4:06 AM
    I have a question that may be a little dumb so I apologize. but where is the array for $opts coming from in events.php of the xapi-translator? I'm trying to add additional details in accounts, like a user's email for the mbox or something along those lines so I can make the records a bit more usable for what we want here.
  • Picture of lee kirkland
    Fri, 9 Oct 2015, 4:45 AM
    Never mind I used file_put_contents('php://stderr', print_r($opts, TRUE)); and it dumped the entire thing to the error log for apache. It would be nice to know what sets it though, still hazy on that, is there a place to look that up?
  • Picture of jerrett fowler
    Fri, 9 Oct 2015, 4:55 PM
    You can basically see what is being sent over via the standard logstore database table. It only associates a userid with the event data. You may grab additional user data by running a query and pulling all data pertaining to that user id. This is already been done for the most part for you. If you look in the github repo, you will find some instructions on contributing to this project. There's 3 libraries you'll need to modify to get the info you're looking for. We've pulled a lot of user data back as a "context" of the event, so if you wanna associate an email with mbox, you should look into doing a pull request. Please take a look at the repos and contribute by doing a pull request.

  • Picture of lee kirkland
    Sat, 17 Oct 2015, 3:52 AM
    Thanks bud! I'll look into doing a pull request. We are also demoing this with watershed, so I'll try and upload anything useful I notice between that LRS and Moodle. I'm also having to program a block, so kinda jammed up right now. But thanks for getting back with me!
  • Picture of wael alkhatib
    Fri, 16 Sep 2016, 9:53 PM
    Thankx for the nice plugin !. Did you test it on moodle 3.1 ?
  • Picture of Ryan Smith
    Fri, 16 Sep 2016, 9:58 PM
    Hi Wael, you're very welcome. I think Jerrett has tested it on Moodle 3.1.
  • Picture of wael alkhatib
    Fri, 16 Sep 2016, 11:17 PM
    Hi Ryan, thankx.
    Which statements are supported since I can see only 'viewed' statements captured
  • Picture of Ryan Smith
    Fri, 16 Sep 2016, 11:42 PM
  • Picture of jerrett fowler
    Mon, 19 Sep 2016, 8:34 PM
    I believe the plugin works on 3.1, although my tests were not exhaustive!
  • Picture of Dillon Esterhuizen
    Tue, 1 Nov 2016, 3:01 PM
    Hi there!

    I have a similar question to Lee Kirkland who posted above. I'm trying to add custom user profile fields to the statements so that they show up in the LRS as well but I'm not sure how to add it in your code. I'm using the plugin version 1.0.0 and Learning Locker as the LRS.

    I understand that there are 3 libraries I need to add it to, i.e. the expander, the translator and the emitter, but I can't figure out where inside of them to add it. I know that the standard log only records the user's id, which means that there must be some query somewhere that then gets all that user's information from the user table as well, but I can't seem to find it to add to that query.

    Do I add it to the controller or the repo of each library, or both the controller and the repo (I would imagine that it shouldn't need to be added to any events as it is information required for every event)? And are there existing functions that I add it to or do I need to create a function specifically to query this data? Also, I would imagine I'd need to add it to the statements as well? I hope I'm asking the right questions.

    Your help would be greatly appreciated!
  • Picture of Ryan Smith
    Tue, 1 Nov 2016, 5:47 PM
    Hey Dillion, this is a really good question and one that will surely be asked again, so I've copied your question to a new Github issue on our repository to make it easier to manage and thread together the conversation, I hope you don't mind.
1 2
Please login to post comments