User_metadata not being returned in log query

I’m working on querying the logs to get the login history for my users. Im using a multi-tenant system tho where a user can belong to many facilities. What I’m trying to do is get the login history for the user but scoped to a specific facility id. The facility id is set in the user_metadata upon account creation. However to test this, I need to be able to see the metadata in the response from the logs endpoint. Without that it is very difficult to ensure that I have the login history scoped correctly. Currently, here is my query string
"/api/v2/logs?q=(user_id:\"#{user.auth0_user_id}\" AND (type:\"s\"))&user_metadata.facility_id:\"#{facility_id}\"&search_engine=v3"

EDIT: I have also tried the include_fields:true&fields=user_metadata to no avail :frowning:

UPDATE2: I have also tried this rule Move User Metadata Attributes To Profile Root Attributes but it did not add it to the root attributes.

Hi @michael.heft,

Welcome to the community!

The Auth0 “successful login” (type: s) logs do not log arbitrary data from a user’s metadata. Each log type: has its own format, varying from one type: to another. This is probably best handled within your own app.