.NET开源MSSQL、Redis监控产品Opserver之Exception配置
异常日志的记录和监控主要依赖于StackExchange.Exceptional组件,默认已经被引进来了。
先看下config文件夹下的ExceptionsSettings.json.example文件
- {
- "warningRecentCount": "", //警告提醒最近条目数,当超出该值在头部高亮显示警告
- "criticalRecentCount": "", //严重警告提醒最近条目数,当超出该值在头部高亮显示严重警告
- "viewGroups": "StatusExceptionsRO", //安全模式“ad"下的分组查看权限设置
- // You can have a simple applications list here, or a grouped structure when dealing with many apps.
- //"applications": [ //产生异常日志的程序
- // "Core",
- // "Chat",
- // "Stack Auth",
- // "StackExchange.com",
- // "API",
- // "API v2",
- // "Area 51",
- // "Status",
- // "Push Server",
- // "Sockets",
- // "Careers",
- // "BackOffice",
- // "Control Panel"
- //],
- //以分组在形式归类异常日志,未在groups定义的在others中显示
- "groups": [
- {
- "name": "Core Q&A",
- "applications": [
- "Core",
- "Chat",
- "Stack Auth",
- "StackExchange.com",
- "API v2",
- "Sockets",
- "Area 51",
- "Open ID",
- "Stack Server",
- "StackSnippets",
- "Status"
- ]
- },
- {
- "name": "Careers",
- "applications": [
- "Careers",
- "BackOffice",
- "BackOffice",
- "Control Panel",
- "StackShop",
- "CareersAuth"
- ]
- },
- {
- "name": "Mobile",
- "applications": [
- "Push Server"
- ]
- },
- {
- "name": "Ads & Data",
- "applications": [
- "Prov Read API"
- ]
- }
- ],
- "stores": [ //异常日志存储位置
- {
- "name": "New York",
- "queryTimeoutMs": ,
- "pollIntervalSeconds": ,
- "connectionString": "Data Source=192.168.11.210;Initial Catalog=Opserver;User ID=sa;Password=Luzou+18518095396;"
- }
- ],
"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>"
}
]- }
首先需要建一下数据库
- CREATE TABLE [dbo].[Exceptions](
- [Id] [bigint] IDENTITY(1,1) NOT NULL,
- [GUID] [uniqueidentifier] NOT NULL,
- [ApplicationName] [nvarchar](50) NOT NULL,
- [MachineName] [nvarchar](50) NOT NULL,
- [CreationDate] [datetime] NOT NULL,
- [Type] [nvarchar](100) NOT NULL,
- [IsProtected] [bit] NOT NULL,
- [Host] [nvarchar](100) NULL,
- [Url] [nvarchar](500) NULL,
- [HTTPMethod] [nvarchar](10) NULL,
- [IPAddress] [varchar](40) NULL,
- [Source] [nvarchar](100) NULL,
- [Message] [nvarchar](1000) NULL,
- [Detail] [nvarchar](max) NULL,
- [StatusCode] [int] NULL,
- [SQL] [nvarchar](max) NULL,
- [DeletionDate] [datetime] NULL,
- [FullJson] [nvarchar](max) NULL,
- [ErrorHash] [int] NULL,
- [DuplicateCount] [int] NOT NULL,
- CONSTRAINT [PK_Exceptions] PRIMARY KEY CLUSTERED
- (
- [Id] ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
- GO
- SET ANSI_PADDING OFF
- GO
- ALTER TABLE [dbo].[Exceptions] ADD DEFAULT ((0)) FOR [IsProtected]
- GO
- ALTER TABLE [dbo].[Exceptions] ADD DEFAULT ((1)) FOR [DuplicateCount]
- GO
然后webconfig下需要进行配置
- <Exceptional applicationName="Status">
- <ErrorStore type="SQL" connectionString="Data Source=192.168.11.210;Initial Catalog=Opserver;User ID=sa;Password=*******" />
- </Exceptional>
- <!-- Which ErrorStore to use, if no element is declared here a Memory store with defaults will be used -->
- <!--<ErrorStore type="Memory" />-->
- <!-- Other store types, common attributes:
- - rollupSeconds: optional (default seconds), determines how long the window is to roll up exceptions with the same stack trace - to not roll up
- - 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 -->
- <!-- JSON: size defaults to , this is how many files are kept before the oldest error is removed -->
- <!--<ErrorStore type="JSON" path="~/Errors" size="" />-->
- <!-- 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). -->
- <!--<ErrorStore type="SQL" connectionString="Server=.;Database=Exceptions;Uid=Exceptions;Pwd=myPassword!" />-->
- <!--<ErrorStore type="SQL" connectionStringName="MyConnectionString" />-->
- <!-- You can also use a MySQL Database with the MySQL ErorrStore -->
- <!--<ErrorStore type="MySQL" connectionString="Server=.;Database=Exceptions;Username=Exceptions;Pwd=myPassword!" />-->
- <!--<ErrorStore type="MySQL" connectionStringName="MyConnectionString" />-->
好吧,其实这就搞定了,就是这么简单,然后上下效果图
Opserver系列目录 http://www.cnblogs.com/xiaopotian/category/1007536.html
.NET开源MSSQL、Redis监控产品Opserver之Exception配置的更多相关文章
- .NET开源MSSQL、Redis监控产品Opserver之安全配置
简介 Opserver是Stack Overflow的开源监控解决方案,由Stack Exchange发布,基于.NET框架构建.开源地址:https://github.com/opserver/Op ...
- .NET开源MSSQL、Redis监控产品Opserver之MSSQL配置
MSSQL的配置比较简单,主要包括三部分: 默认配置(defaultConnectionString).集群配置(clusters).单实例配置(instances) defaultConnectio ...
- .NET开源MSSQL、Redis监控产品Opserver之Redis配置
安全与基础配置地址:http://www.cnblogs.com/xiaopotian/p/6898310.html edis监控数据实例的加载可以查看Opserver.Core项目data/Redi ...
- Redis学习笔记之一 : 配置redis
Redis 简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库. Redis 与其他 key - value 缓存产品有以下三个特点: Redis支持数据的持久 ...
- Springboot 2.0.x 集成基于Centos7的Redis集群安装及配置
Redis简介 Redis是一个基于C语言开发的开源(BSD许可),开源高性能的高级内存数据结构存储,用作数据库.缓存和消息代理.它支持数据结构,如 字符串.散列.列表.集合,带有范围查询的排序集,位 ...
- Redis简介、安装、配置、启用学习笔记
前一篇文章有介绍关系型数据库和非关系型数据库的差异,现在就来学习一下用的较广的非关系型数据库:Redis数据库 Redis 简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-v ...
- redis简介、安装、配置和数据类型
redis简介.安装.配置和数据类型 redis简介 Redis是一个开源(BSD许可),内存存储的数据结构服务器,可用作数据库,高速缓存和消息队列代理. 它支持字符串.哈希表.列表.集合.有序集合, ...
- Linux下的python3,virtualenv,Mysql、nginx、redis等常用服务安装配置
Linux下的python3,virtualenv,Mysql.nginx.redis等常用服务安装配置 学了前面的Linux基础,想必童鞋们是不是更感兴趣了?接下来就学习常用服务部署吧! 安装环 ...
- 开源IDE CodeBlocks的下载安装、配置、简单编程
如果没有集成开发环境(IDE),在linux下开发程序将非常繁琐,IDE是指将编辑.编译.调试等功能集成在一个桌面环境上,这样就大大方便了用户.IDE一般包括代码编辑器.编译器.调试器和图形界面用户工 ...
随机推荐
- STL sort
STL的sort()算法,数据量大时采用Quick Sort,分段递归排序,一旦分段后的数据量小于某个门槛,为避免Quick Sort的递归调用带来过大的额外负荷,就改用Insertion Sort. ...
- dom4J使用笔记
使用dom4j是目前最常用的解析XML的方法,dom4j解析集DOM和SAX技术优点于一身,要使用dom4j 还是先要导入jar: dom4j-1.6.1.jar (dom4j最主要的jar包,可以独 ...
- FBVector
folly/FBVector.h Simply replacing std::vector with folly::fbvector (after having included the folly/ ...
- 短URL链接系统
定义: 短网址(Short URL),顾名思义就是在形式上比较短的网址.但不知道有多少人像我一样,由于面试问道才知道有这种系统而对短连接原理好奇,从而进行进一步的研究.在Web 2.0的今天,不得不说 ...
- Defining Python Source Code Encodings
Defining the Encoding Python will default to ASCII as standard encoding if no other encoding hints a ...
- 第七章 : Git 介绍 (上)[Learn Android Studio 汉化教程]
Learn Android Studio 汉化教程 [翻译]Git介绍 Git版本控制系统(VCS)快速成为Android应用程序开发以及常规的软件编程领域内的事实标准.有别于需要中心服务器支持的早期 ...
- java根据pdf模版动态生成pdf
java根据pdf模版动态生成pdf package com.utils; import java.io.ByteArrayOutputStream; import java.io.File; imp ...
- 获取lable选中时触发事件
通常做网页时不会用radio和checkbox的原有样式, 会进行样式美化. 如何在点击checkbox时触发一个事件呢? <div class="main-checkbox" ...
- C# a++ 与 ++a 的区别
C# a++ 与 ++a 的区别 运行环境:Window7 64bit,.NetFramework4.61,C# 6.0: 编者:乌龙哈里 2017-02-21 查资料时看到别人的写法 while(+ ...
- 用django框架开发一个B2C购物网站的基本流程和用到的知识点总结1
开发流程 开发模式采用前后端分离模式,作为后端开发人员我们只关注后端业务逻辑开发: 省略项目框架搭建文件的配置部分.... 一:用户部分 在项目开发中我们要用到用户模型类User,Django认证系统 ...