异常日志的记录和监控主要依赖于StackExchange.Exceptional组件,默认已经被引进来了。

先看下config文件夹下的ExceptionsSettings.json.example文件

  1. {
  2. "warningRecentCount": "", //警告提醒最近条目数,当超出该值在头部高亮显示警告
  3. "criticalRecentCount": "", //严重警告提醒最近条目数,当超出该值在头部高亮显示严重警告
  4. "viewGroups": "StatusExceptionsRO", //安全模式“ad"下的分组查看权限设置
  5. // You can have a simple applications list here, or a grouped structure when dealing with many apps.
  6. //"applications": [ //产生异常日志的程序
  7. // "Core",
  8. // "Chat",
  9. // "Stack Auth",
  10. // "StackExchange.com",
  11. // "API",
  12. // "API v2",
  13. // "Area 51",
  14. // "Status",
  15. // "Push Server",
  16. // "Sockets",
  17. // "Careers",
  18. // "BackOffice",
  19. // "Control Panel"
  20. //],
  21.  
  22. //以分组在形式归类异常日志,未在groups定义的在others中显示
  23. "groups": [
  24. {
  25. "name": "Core Q&A",
  26. "applications": [
  27. "Core",
  28. "Chat",
  29. "Stack Auth",
  30. "StackExchange.com",
  31. "API v2",
  32. "Sockets",
  33. "Area 51",
  34. "Open ID",
  35. "Stack Server",
  36. "StackSnippets",
  37. "Status"
  38. ]
  39. },
  40. {
  41. "name": "Careers",
  42. "applications": [
  43. "Careers",
  44. "BackOffice",
  45. "BackOffice",
  46. "Control Panel",
  47. "StackShop",
  48. "CareersAuth"
  49. ]
  50. },
  51. {
  52. "name": "Mobile",
  53. "applications": [
  54. "Push Server"
  55. ]
  56. },
  57. {
  58. "name": "Ads & Data",
  59. "applications": [
  60. "Prov Read API"
  61. ]
  62. }
  63. ],
  64. "stores": [ //异常日志存储位置
  65. {
  66. "name": "New York",
  67. "queryTimeoutMs": ,
  68. "pollIntervalSeconds": ,
  69. "connectionString": "Data Source=192.168.11.210;Initial Catalog=Opserver;User ID=sa;Password=Luzou+18518095396;"
  70. }
  71. ],
      "stackTraceReplacements": [
        {
          "name": "github",
          "pattern": "(?<= in )https?://raw.githubusercontent.com/([^/]+/)([^/]+/)([^/]+/)(.*?):line (\\d+)",
          "replacement": "<a href=\"https://github.com/$1$2blob/$3$4#L$5\">$4:line $5</a>"
        }
      ]
  72. }

首先需要建一下数据库

  1. CREATE TABLE [dbo].[Exceptions](
  2. [Id] [bigint] IDENTITY(1,1) NOT NULL,
  3. [GUID] [uniqueidentifier] NOT NULL,
  4. [ApplicationName] [nvarchar](50) NOT NULL,
  5. [MachineName] [nvarchar](50) NOT NULL,
  6. [CreationDate] [datetime] NOT NULL,
  7. [Type] [nvarchar](100) NOT NULL,
  8. [IsProtected] [bit] NOT NULL,
  9. [Host] [nvarchar](100) NULL,
  10. [Url] [nvarchar](500) NULL,
  11. [HTTPMethod] [nvarchar](10) NULL,
  12. [IPAddress] [varchar](40) NULL,
  13. [Source] [nvarchar](100) NULL,
  14. [Message] [nvarchar](1000) NULL,
  15. [Detail] [nvarchar](max) NULL,
  16. [StatusCode] [int] NULL,
  17. [SQL] [nvarchar](max) NULL,
  18. [DeletionDate] [datetime] NULL,
  19. [FullJson] [nvarchar](max) NULL,
  20. [ErrorHash] [int] NULL,
  21. [DuplicateCount] [int] NOT NULL,
  22. CONSTRAINT [PK_Exceptions] PRIMARY KEY CLUSTERED
  23. (
  24. [Id] ASC
  25. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  26. ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
  27.  
  28. GO
  29.  
  30. SET ANSI_PADDING OFF
  31. GO
  32.  
  33. ALTER TABLE [dbo].[Exceptions] ADD DEFAULT ((0)) FOR [IsProtected]
  34. GO
  35.  
  36. ALTER TABLE [dbo].[Exceptions] ADD DEFAULT ((1)) FOR [DuplicateCount]
  37. GO

然后webconfig下需要进行配置

  1. <Exceptional applicationName="Status">
  2. <ErrorStore type="SQL" connectionString="Data Source=192.168.11.210;Initial Catalog=Opserver;User ID=sa;Password=*******" />
  3. </Exceptional>
  1. <!-- Which ErrorStore to use, if no element is declared here a Memory store with defaults will be used -->
  2. <!--<ErrorStore type="Memory" />-->
  3. <!-- Other store types, common attributes:
  4. - rollupSeconds: optional (default seconds), determines how long the window is to roll up exceptions with the same stack trace - to not roll up
  5. - backupQueueSize: optional (default ), determines how many errors to cache (excluding rollups) in memory when logging fails...every seconds we'll retry logging and flush these out to the final store -->
  6. <!-- JSON: size defaults to , this is how many files are kept before the oldest error is removed -->
  7. <!--<ErrorStore type="JSON" path="~/Errors" size="" />-->
  8. <!-- SQL: only a connection string or connection string name is needed, many applications can log to the same place as long as they have unique names (otherwise we can't tell them apart). -->
  9. <!--<ErrorStore type="SQL" connectionString="Server=.;Database=Exceptions;Uid=Exceptions;Pwd=myPassword!" />-->
  10. <!--<ErrorStore type="SQL" connectionStringName="MyConnectionString" />-->
  11. <!-- You can also use a MySQL Database with the MySQL ErorrStore -->
  12. <!--<ErrorStore type="MySQL" connectionString="Server=.;Database=Exceptions;Username=Exceptions;Pwd=myPassword!" />-->
  13. <!--<ErrorStore type="MySQL" connectionStringName="MyConnectionString" />-->

好吧,其实这就搞定了,就是这么简单,然后上下效果图

Opserver系列目录 http://www.cnblogs.com/xiaopotian/category/1007536.html

.NET开源MSSQL、Redis监控产品Opserver之Exception配置的更多相关文章

  1. .NET开源MSSQL、Redis监控产品Opserver之安全配置

    简介 Opserver是Stack Overflow的开源监控解决方案,由Stack Exchange发布,基于.NET框架构建.开源地址:https://github.com/opserver/Op ...

  2. .NET开源MSSQL、Redis监控产品Opserver之MSSQL配置

    MSSQL的配置比较简单,主要包括三部分: 默认配置(defaultConnectionString).集群配置(clusters).单实例配置(instances) defaultConnectio ...

  3. .NET开源MSSQL、Redis监控产品Opserver之Redis配置

    安全与基础配置地址:http://www.cnblogs.com/xiaopotian/p/6898310.html edis监控数据实例的加载可以查看Opserver.Core项目data/Redi ...

  4. Redis学习笔记之一 : 配置redis

    Redis 简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库. Redis 与其他 key - value 缓存产品有以下三个特点: Redis支持数据的持久 ...

  5. Springboot 2.0.x 集成基于Centos7的Redis集群安装及配置

    Redis简介 Redis是一个基于C语言开发的开源(BSD许可),开源高性能的高级内存数据结构存储,用作数据库.缓存和消息代理.它支持数据结构,如 字符串.散列.列表.集合,带有范围查询的排序集,位 ...

  6. Redis简介、安装、配置、启用学习笔记

    前一篇文章有介绍关系型数据库和非关系型数据库的差异,现在就来学习一下用的较广的非关系型数据库:Redis数据库 Redis 简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-v ...

  7. redis简介、安装、配置和数据类型

    redis简介.安装.配置和数据类型 redis简介 Redis是一个开源(BSD许可),内存存储的数据结构服务器,可用作数据库,高速缓存和消息队列代理. 它支持字符串.哈希表.列表.集合.有序集合, ...

  8. Linux下的python3,virtualenv,Mysql、nginx、redis等常用服务安装配置

    Linux下的python3,virtualenv,Mysql.nginx.redis等常用服务安装配置   学了前面的Linux基础,想必童鞋们是不是更感兴趣了?接下来就学习常用服务部署吧! 安装环 ...

  9. 开源IDE CodeBlocks的下载安装、配置、简单编程

    如果没有集成开发环境(IDE),在linux下开发程序将非常繁琐,IDE是指将编辑.编译.调试等功能集成在一个桌面环境上,这样就大大方便了用户.IDE一般包括代码编辑器.编译器.调试器和图形界面用户工 ...

随机推荐

  1. STL sort

    STL的sort()算法,数据量大时采用Quick Sort,分段递归排序,一旦分段后的数据量小于某个门槛,为避免Quick Sort的递归调用带来过大的额外负荷,就改用Insertion Sort. ...

  2. dom4J使用笔记

    使用dom4j是目前最常用的解析XML的方法,dom4j解析集DOM和SAX技术优点于一身,要使用dom4j 还是先要导入jar: dom4j-1.6.1.jar (dom4j最主要的jar包,可以独 ...

  3. FBVector

    folly/FBVector.h Simply replacing std::vector with folly::fbvector (after having included the folly/ ...

  4. 短URL链接系统

    定义: 短网址(Short URL),顾名思义就是在形式上比较短的网址.但不知道有多少人像我一样,由于面试问道才知道有这种系统而对短连接原理好奇,从而进行进一步的研究.在Web 2.0的今天,不得不说 ...

  5. Defining Python Source Code Encodings

    Defining the Encoding Python will default to ASCII as standard encoding if no other encoding hints a ...

  6. 第七章 : Git 介绍 (上)[Learn Android Studio 汉化教程]

    Learn Android Studio 汉化教程 [翻译]Git介绍 Git版本控制系统(VCS)快速成为Android应用程序开发以及常规的软件编程领域内的事实标准.有别于需要中心服务器支持的早期 ...

  7. java根据pdf模版动态生成pdf

    java根据pdf模版动态生成pdf package com.utils; import java.io.ByteArrayOutputStream; import java.io.File; imp ...

  8. 获取lable选中时触发事件

    通常做网页时不会用radio和checkbox的原有样式, 会进行样式美化. 如何在点击checkbox时触发一个事件呢? <div class="main-checkbox" ...

  9. C# a++ 与 ++a 的区别

    C# a++ 与 ++a 的区别 运行环境:Window7 64bit,.NetFramework4.61,C# 6.0: 编者:乌龙哈里 2017-02-21 查资料时看到别人的写法 while(+ ...

  10. 用django框架开发一个B2C购物网站的基本流程和用到的知识点总结1

    开发流程 开发模式采用前后端分离模式,作为后端开发人员我们只关注后端业务逻辑开发: 省略项目框架搭建文件的配置部分.... 一:用户部分 在项目开发中我们要用到用户模型类User,Django认证系统 ...