This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in global.asax | |
void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e) | |
{ | |
var ctx = e.Context as HttpContext; | |
if(ctx == null) | |
{ | |
return; | |
} | |
ElmahSensitiveDataFilter.Apply(e, ctx); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RouteModule : NancyModule | |
{ | |
public RouteModule(IRouteCacheProvider routeCache) | |
{ | |
Get["/routes/all"] = _ => routeCache.GetCache().Select(entry => new | |
{ | |
Module = entry.Key.Name, | |
Routes = entry.Value.Select(route => route.Item2.Method + " " + route.Item2.Path) | |
}); | |
Get["/route/{moduleName}"] = _ => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void Configure(Funq.Container container) | |
{ | |
const string statsdPrefix = "Qas.Web"; | |
//common config shared with tests | |
Config.Configure(); | |
container.Register<IStatsd>(c => new Statsd(new StatsdUDP("localhost", 8125))); | |
Plugins.Add(new MetricsFeature(container.Resolve<IStatsd>(), statsdPrefix)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ElmahSensitiveDataFilter | |
{ | |
public static void Apply(ExceptionFilterEventArgs e, HttpContext ctx) | |
{ | |
var sensitiveFormData = ctx.Request.Form.AllKeys.GetSensitiveFormData(); | |
if (sensitiveFormData.Count == 0) | |
{ | |
return; | |
} | |
var error = new Error(e.Exception, ctx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration> | |
<configSections> | |
<section name="secureAppSettings" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | |
</configSections> | |
<secureAppSettings> | |
<add key="encryptMe" value="ImSuperSecret" /> | |
</secureAppSettings> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Globalization; | |
using System.Text; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
using NLog; | |
using NLog.LayoutRenderers; | |
namespace Cats.Middleware.Logging | |
{ | |
[LayoutRenderer("json")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
stdin { type => example } | |
file { | |
#any line not starting with a tleast 10 dashes belongs with the previous line | |
codec => multiline { | |
pattern => "^-{10,}" | |
negate => true | |
what => next | |
} | |
path => "C:/applogs/*.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log = "DateTime: 23/04/1998\r\nI'm just a message\r\nKey: value\r\nIm a url: http://cats.com\r\nError Description: I'm an error here is my stacktrace\r\n at stuff\r\n at more stuff\r\n\key with no value: \r\nI'm another random message line\r\n--------------------------------------------" | |
rows = log.split(/\r\n/).partition{|x| x.start_with?('Error Description: ',' at')} | |
event = {'Error'=>rows[0].join($/).sub('Error Description: ','')} | |
remove = [] | |
rows[1].each do |i| | |
i.scan(/(.+): (.*)/) do |x,y| | |
event[x.delete(' ')] = y | |
remove.push(i) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
finder = require('finder-on-steroids'); | |
var app = express(); | |
app.use(express.static('../results')); | |
app.listen(9085); | |
app.get('/', function(req, res, next) { | |
finder('../results').files().depth(2).name('index.html').find().then(function(files) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "AWS CloudFormation demo thingy", | |
"Parameters" : { | |
"KeyName": { | |
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the Elastic Beanstalk hosts", | |
"Type": "AWS::EC2::KeyPair::KeyName", |
OlderNewer