Server Event Log Dashboard

Update for Dropdown modification:

Edit: First post updated above.
Here are the two files that changed:

The customization on the dashboard, and an additional query.

Files from original post

App.KEV_EventLog.MainController_Customization_EventLogV1_CustomExport.xml (285.6 KB)
KEV_EventLogList.baq (20.3 KB)

Query Info:

/*
 * Disclaimer!!!
 * This is not a real query being executed, but a simplified version for general vision.
 * Executing it with any other tool may produce a different result.
 */
 
select 
	(null) as [Calculated_EventLogName],
	(null) as [Calculated_DisplayName]

Query Code on GetList:

    string retString = "";
    string nl = Environment.NewLine;
    
    
    result.Results.Clear();

    //No reference available in "Usings & References - Assemblies", so we will load by reflection.
    Assembly System_Diagnostics_EventLog = Assembly.Load("System.Diagnostics.EventLog");

    Type typeEventLog = System_Diagnostics_EventLog.GetType("System.Diagnostics.EventLog");
    
    MethodInfo methodGetEventLogs = typeEventLog.GetMethods().FirstOrDefault
              (method => method.Name == "GetEventLogs"
              && method.GetParameters().Count() == 0);
    
    
    
    IEnumerable<dynamic> eventLogs = (dynamic)methodGetEventLogs.Invoke(null, null);
    
    List<ResultsUbaqRow> logRange = new List<ResultsUbaqRow>(); 
    
    foreach(dynamic item in eventLogs)
    {
      try
      {
        //retString += $"Log: {item.Log.PadRight(40)} DisplayName: {item.LogDisplayName.PadRight(40)} MinRetention: {item.MinimumRetentionDays.ToString().PadRight(40)} MaxKB: {item.MaximumKilobytes.ToString().PadRight(40)} \n";
        logRange.Add(new ResultsUbaqRow
          {
            Calculated_EventLogName = item.Log,
            Calculated_DisplayName = item.LogDisplayName,
            SysRowID = Guid.NewGuid(),
            RowIdent = DateTime.Now.Ticks.ToString(),
            RowMod = "A",
          });
        
      }
      catch(Exception ex)
      {
        //Trying to read from "Security" Event Log, or another you do not have access to...
        if(ex is System.Security.SecurityException)
        {
          //retString += ex.Message + nl;
        }
      }
    }
    
    result.Results.AddRange(logRange);
    
    //if(!string.IsNullOrEmpty(retString)) InfoMessage.Publish(retString);
   
3 Likes