public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            var log = request;

            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestId), new ScalarValue(log.RequestId)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Method), new ScalarValue(log.Method)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Path), new ScalarValue(log.Path)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.QueryString), new ScalarValue(log.QueryString)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestHostName), new ScalarValue(log.RequestHostName)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestContentLength), new ScalarValue(log.RequestContentLength)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestContentType), new ScalarValue(log.RequestContentType)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestBodyContent), new ScalarValue(log.RequestBodyContent)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.UserIPAddress), new ScalarValue(log.UserIPAddress)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestHeaders), EnricherProps.FromDictionary(log.RequestHeaders)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Query), EnricherProps.FromDictionary(log.Query)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestCookies), EnricherProps.FromDictionary(log.RequestCookies)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.UserAgentDevice), new ScalarValue(log.UserAgentDevice)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.UserAgentFamily), new ScalarValue(log.UserAgentFamily)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.UserAgentOS), new ScalarValue(log.UserAgentOS)));


            foreach (var ignoredField in options.IgnoredRequestLogFields.ToArray())
            {
                logEvent.RemovePropertyIfPresent(ignoredField);
            }
        }
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            var log = request;

            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestId), new ScalarValue(log.RequestId)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Method), new ScalarValue(log.Method)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Path), new ScalarValue(log.Path)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.QueryString), new ScalarValue(log.QueryString)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestHostName), new ScalarValue(log.RequestHostName)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestContentLength), new ScalarValue(log.RequestContentLength)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestContentType), new ScalarValue(log.RequestContentType)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestBodyContent), new ScalarValue(log.RequestBodyContent)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.UserIPAddress), new ScalarValue(log.UserIPAddress)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestHeaders), EnricherProps.FromDictionary(log.RequestHeaders)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Query), EnricherProps.FromDictionary(log.Query)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestCookies), EnricherProps.FromDictionary(log.RequestCookies)));
        }
示例#3
0
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(errorLog.Duration), new ScalarValue(errorLog.Duration)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(errorLog.StatusCode), new ScalarValue(errorLog.StatusCode)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(errorLog.RequestId), new ScalarValue(errorLog.RequestId)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(errorLog.ResolvedPath), new ScalarValue(errorLog.ResolvedPath)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(errorLog.RequestedPath), new ScalarValue(errorLog.RequestedPath)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(errorLog.Method), new ScalarValue(errorLog.Method)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(errorLog.ResolvedRouteParameters), EnricherProps.FromDictionary(errorLog.ResolvedRouteParameters)));

            foreach (var ignoreField in options.IgnoreErrorLogFields.ToArray())
            {
                logEvent.RemovePropertyIfPresent(ignoreField);
            }
        }
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            var ignoredFields = options.IgnoredResponseLogFields.ToArray();
            var log           = response;

            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestId), new ScalarValue(log.RequestId)));



            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.StatusCode), new ScalarValue(log.StatusCode)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseContentType), new ScalarValue(log.ResponseContentType)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Duration), new ScalarValue(log.Duration)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Method), new ScalarValue(log.Method)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ReasonPhrase), new ScalarValue(log.ReasonPhrase)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResolvedPath), new ScalarValue(log.ResolvedPath)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestedPath), new ScalarValue(log.RequestedPath)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseHeaders), EnricherProps.FromDictionary(log.ResponseHeaders)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseContent), new ScalarValue(log.ResponseContent)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseContentLength), new ScalarValue(log.ResponseContentLength)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RawResponseCookies), EnricherProps.FromCookies(log.RawResponseCookies)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseCookies), EnricherProps.FromDictionary(log.ResponseCookies)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResolvedRouteParameters), EnricherProps.FromDictionary(log.ResolvedRouteParameters)));


            foreach (var ignoredField in ignoredFields)
            {
                logEvent.RemovePropertyIfPresent(ignoredField);
            }
        }
示例#5
0
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            var log = response;

            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestId), new ScalarValue(log.RequestId)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.StatusCode), new ScalarValue(log.StatusCode)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseContentType), new ScalarValue(log.ResponseContentType)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.Duration), new ScalarValue(log.Duration)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ReasonPhrase), new ScalarValue(log.ReasonPhrase)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResolvedPath), new ScalarValue(log.ResolvedPath)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RequestedPath), new ScalarValue(log.RequestedPath)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseHeaders), EnricherProps.FromDictionary(log.ResponseHeaders)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseContent), new ScalarValue(log.ResponseContent)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseContentLength), new ScalarValue(log.ResponseContentLength)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.RawResponseCookies), EnricherProps.FromCookies(log.RawResponseCookies)));
            logEvent.AddOrUpdateProperty(new LogEventProperty(nameof(log.ResponseCookies), EnricherProps.FromDictionary(log.ResponseCookies)));
        }