public bool ShouldRequestBeFiltered(SitkaRequestInfo requestInfo)
 {
     if (requestInfo.OriginalException is System.Web.HttpException)
     {
         return(requestInfo.OriginalException.Message.Contains("The remote host closed the connection", StringComparison.InvariantCultureIgnoreCase));
     }
     return(false);
 }
コード例 #2
0
 /// <summary>
 ///     Don't log an error if request is unsupported HTTP method and code has responded deliberately to with a "405 Method Not Allowed"
 /// </summary>
 public bool ShouldRequestBeFiltered(SitkaRequestInfo requestInfo)
 {
     // If this request was for an HTTP method that isn't allowed...
     if (!IsHttpRequestMethodAllowed(requestInfo.Method))
     {
         // And the code is returning HTTP STATUS CODE "405 Method Not Allowed" - Then don't log it
         return(requestInfo.StatusCode == (int)HttpStatusCodeForUnsupportedMethods);
     }
     // Otherwise log the message - something else weird happened
     return(false);
 }
コード例 #3
0
        public bool ShouldRequestBeFiltered(SitkaRequestInfo requestInfo)
        {
            // Should be filtered if:
            // - This is a display exception with a HTTP code
            // - that HTTP code is 503 - Service Unavailable
            if (requestInfo.OriginalException is SitkaDisplayErrorExceptionWithHttpCode)
            {
                var exception = (SitkaDisplayErrorExceptionWithHttpCode)requestInfo.OriginalException;
                return(exception.HttpStatusCode == HttpStatusCode.ServiceUnavailable);
            }

            return(false);
        }
コード例 #4
0
        public bool ShouldRequestBeFiltered(SitkaRequestInfo requestInfo)
        {
            //should be filtered if status code is 404 and there is no referrer
            if (requestInfo.OriginalException is HttpException)
            {
                var http = (HttpException)requestInfo.OriginalException;
                return(http.GetHttpCode() == (int)HttpStatusCode.NotFound &&
                       (requestInfo.UrlReferrer == null ||
                        String.IsNullOrWhiteSpace(requestInfo.UrlReferrer.ToString())));
            }

            //should also be filtered out if exception is SitkaRecordNotFoundException and there is no referrer
            if (requestInfo.OriginalException is SitkaRecordNotFoundException)
            {
                return(requestInfo.UrlReferrer == null || String.IsNullOrWhiteSpace(requestInfo.UrlReferrer.ToString()));
            }

            return(false);
        }
コード例 #5
0
 public bool ShouldRequestBeFiltered(SitkaRequestInfo requestInfo)
 {
     return(
         // Via: 1.0 wtp-g3-maya1.sjdc:3128 (squid/2.6.STABLE21)
         Regex.IsMatch(requestInfo.DebugInfo.RequestInfo, @"^Via:.*\.sjdc", RegexOptions.Multiline) ||
         // Via: 1.0 wtp-gd-maya7.iad1:3128 (squid/2.6.STABLE21)
         Regex.IsMatch(requestInfo.DebugInfo.RequestInfo, @"^Via:.*\.iad1", RegexOptions.Multiline) ||
         // Via: 1.0 wtp-go-maya1.sjdc.dcsecct.trendmicro.com:3128 (squid/2.6.STABLE21)
         Regex.IsMatch(requestInfo.DebugInfo.RequestInfo, @"^Via:.*\.trendmicro\.com", RegexOptions.Multiline) ||
         // Hostname: 150-70-64-214.trendmicro.com
         requestInfo.DebugInfo.Hostname.EndsWith("trendmicro.com", StringComparison.InvariantCultureIgnoreCase) ||
         // Hostname: 150-70-64-214.trendmicro.org
         requestInfo.DebugInfo.Hostname.EndsWith("trendnet.org", StringComparison.InvariantCultureIgnoreCase) ||
         // Hostname: xxxx.sjdc
         requestInfo.DebugInfo.Hostname.EndsWith(".sjdc", StringComparison.InvariantCultureIgnoreCase) ||
         // Hostname: wtp-gd-maya1.iad1
         requestInfo.DebugInfo.Hostname.EndsWith(".iad1", StringComparison.InvariantCultureIgnoreCase) ||
         requestInfo.DebugInfo.WhoIsInfo.Contains("trendmicro", StringComparison.InvariantCultureIgnoreCase));
 }
コード例 #6
0
 public bool ShouldRequestBeFiltered(SitkaRequestInfo requestInfo)
 {
     // we were checking for the error message, but then it would give an error like: Http Server is returning response status code "500 Internal Server Error" and error was not logged via the Application_Error method
     // so we filter all Head request errors.
     return(requestInfo.DebugInfo.RequestInfo.StartsWith("HEAD") || requestInfo.DebugInfo.RequestInfo.StartsWith("PROPFIND") || requestInfo.DebugInfo.RequestInfo.StartsWith("OPENVAS"));// && requestInfo.OriginalException != null && requestInfo.OriginalException.Message == "The requested resource can only be accessed via SSL.";
 }
コード例 #7
0
 public bool ShouldRequestBeFiltered(SitkaRequestInfo requestInfo)
 {
     return(requestInfo.DebugInfo.Hostname.EndsWith(".semrush.com", StringComparison.InvariantCultureIgnoreCase) ||
            requestInfo.DebugInfo.WhoIsInfo.Contains("*****@*****.**", StringComparison.InvariantCultureIgnoreCase));
 }
コード例 #8
0
 public bool ShouldRequestBeFiltered(SitkaRequestInfo requestInfo)
 {
     return((requestInfo.UserAgent ?? string.Empty).ToLower().Contains("nagios"));
 }