/// <summary> /// Creates the syslog structured data containing system information. /// </summary> /// <returns></returns> private SyslogSdElement CreateSystemInfoData() { var sdElement = new SyslogSdElement($"systemInfo@{EnterpriseId.ToString(CultureInfo.InvariantCulture)}"); sdElement.Parameters.Add(new SyslogSdParameter("installDirectory", InstallFolder)); sdElement.Parameters.Add(new SyslogSdParameter("databaseName", DatabaseName)); sdElement.Parameters.Add(new SyslogSdParameter("databaseServer", DatabaseServer)); return(sdElement); }
/// <summary> /// Creates the extra message data from the log entry. /// </summary> /// <param name="logEntry"></param> /// <returns></returns> private SyslogSdElement CreateExtraMsgData(EventLogEntry logEntry) { var sdElement = new SyslogSdElement($"{EventLogMsgId}@{EnterpriseId.ToString(CultureInfo.InvariantCulture)}"); sdElement.Parameters.Add(new SyslogSdParameter("msgId", EventLogMsgId)); sdElement.Parameters.Add(new SyslogSdParameter("tenant", logEntry.TenantName)); sdElement.Parameters.Add(new SyslogSdParameter("tenantId", logEntry.TenantId.ToString(CultureInfo.InvariantCulture))); sdElement.Parameters.Add(new SyslogSdParameter("user", logEntry.UserName)); // Sd parameter is called logEntrySource for source as source appears be used by graylog for the name of the source machine sdElement.Parameters.Add(new SyslogSdParameter("logEntrySource", logEntry.Source)); sdElement.Parameters.Add(new SyslogSdParameter("threadId", logEntry.ThreadId.ToString(CultureInfo.InvariantCulture))); return(sdElement); }
/// <summary> /// Creates the syslog structured data containing origin parameters. /// </summary> /// <param name="ipHostEntry">The ip host entry.</param> /// <returns></returns> private SyslogSdElement CreateOriginData(IPHostEntry ipHostEntry) { var sdElement = new SyslogSdElement(SyslogOriginConstants.Origin); sdElement.Parameters.Add(new SyslogSdParameter(SyslogOriginConstants.EnterpriseId, EnterpriseId.ToString(CultureInfo.InvariantCulture))); sdElement.Parameters.Add(new SyslogSdParameter(SyslogOriginConstants.SwVersion, SoftwareVersion)); sdElement.Parameters.Add(new SyslogSdParameter(SyslogOriginConstants.Software, ApplicationName)); if (ipHostEntry?.AddressList != null && ipHostEntry.AddressList.Length > 0) { foreach (IPAddress ipAddress in ipHostEntry.AddressList) { sdElement.Parameters.Add(new SyslogSdParameter(SyslogOriginConstants.Ip, ipAddress.ToString())); } } return(sdElement); }