In federated When trying to get audit data from child site it returns data from Master site only ?

var masterSite = EnvironmentManager.Instance.MasterSite;

    Item MasterSite = EnvironmentManager.Instance.GetSiteItem(masterSite);

    if (MasterSite != null)

    {

      // federated architecture - get slave server or child sites

      List<Item> sites = MasterSite.GetChildren();

      foreach (Item site in sites)

      {

        try

        {

          System.Collections.ArrayList totalResult = new System.Collections.ArrayList();

          int i = 1;

          while (i > 0)

          {

            System.Collections.ArrayList \_result = new System.Collections.ArrayList();

            System.Collections.ArrayList groups = VideoOS.Platform.Log.LogClient.Instance.ReadGroups(site.FQID.ServerId);

            VideoOS.Platform.Log.LogClient.Instance.ReadLog(

            site.FQID.ServerId,

            i,

            out \_result,

            out \_names,

            "Audit", fromDate.ToUniversalTime(),

            toDate.ToUniversalTime());

            var r = \_result;

            var n = \_names;

            totalResult.AddRange(\_result);

            if (\_result.Count == 0)

            {

              i = -1;

              break;

            }

            else

            {

              i++;

            }

          }

          if (AuditPairs.ContainsKey("data"))

            AuditPairs\["data"\].AddRange(totalResult);

          else

            AuditPairs\["data"\] = totalResult;

          if (AuditPairs.ContainsKey("columns"))

            AuditPairs\["columns"\].AddRange(\_names);

          else

            AuditPairs\["columns"\] = \_names;

        }

        catch (Exception ex)

        {

          Log.Error("Errorwhile getting Audit Logs for site : " + [site.Name](https://site.Name), ex);

        }

      }

    }

    [Log.Info](https://Log.Info)("After Getting all the Audit Logs");

    return AuditPairs;

I was able to reproduce the issue, so you are right that it is not working as expected. Milestone Development will start further investigation and we will get back to you later.

Thanks for the reply.

Do you have any solution for this ?

The only workaround to get the audit logs from a child site would be to log in to the child site independently, as if it was not part of the MFA setup. That would require to re-initialize the SDK environment before retrieving the logs from the child site.

However, this is not a solution we would recommend and we would strongly suggest you to wait for the official fix for the issue.

Thank you

Hi John,

I wanted to let you know that the fix to the issue you reported will be included in 2024 R1 release of MIP SDK.

One additional comment to the code you shared in the first post. When you call Environment.Login(), you are only being logged in to the site with a given serverUri, and not to child sites. You can log in to child sites in two ways:

  • when you iterate through child sites in foreach loop, call Environment.AddServer() and Environment.Login() on that site before retrieving the audit logs,
  • load configuration before entering the foreach loop, for example by calling Configuration.Instance.GetItems(). That should trigger logging in to all child sites. In this case, you need to make sure that masterOnly is set to false when calling AddServer() on the master site.

Thank you for the fix and the response.