As part of our application development we are becoming more and more reliant of logging to help us figure out what’s really going on with the applications. A really nice framework for doing this is serilog. Serilog is an amazing .net logger for producing structure logs. I won’t go into serilog as part of this post but if you are interested in finding out more I highly recommend the pluralsight course http://app.pluralsight.com/courses/modern-structured-logging-serilog-seq
Serilog works even better with the Seq, Seq is a fantastic front end portal that sits over structured logging and makes it really easy to filter noise and get insights into what’s been going on under the hood. It’s even integrated with the new Microsoft.Extensions.Logging.
The main point of this post is to highlight how I got our logging up and running with some spare MSDN credits we had knocking about. The tutorial on the Seq site was great up was a little outdated.
You can find the origianls here http://docs.getseq.net/docs/azure-installation
The following will be more of a step by step guide. In production you may want to make some of the security a little harder. This is a development log server and won’t hold any sensitive information, with a fire-hosed approach to logging you could easily leak out sensitive data so the logging server would need to be secure. I’m sure people with bmore battle sense than myself will point out better approaches to this.
Ok so, first steps. Login to your Azure portal. https://portal.azure.com. A great part of the Microsoft Develop Network benefits are Azure credits, this are what I’ll be using for our server here.
in the search bar start to type windows server and you should see the 2012 R2 Datacenter option appear. Select that.
Select that edition form the list of returned results and you will be presented with another “blade” (Blades are a key part of the new Azure portal and have taken me a while to get used to but they grown on you.)
In the new blade leave the drop down selected as “Resource Manger” then hit the create button.
You will new be presented with a wizard that guides you through the steps to configure the new Virtual Machine Instance.
Set up the Name, username, Password and also the subscription and Resource Group. For this example I’ve simply left that as the Default-Storage for North Europe.
Next you will be presented with a Size option, In this example I selected A1 as it’s a pretty cheap option and for logging you don’t necessarily need SSD and multicore. We havea machine set up on the D1 plan with SSD and it’s a little faster but not drastically so. The choice is your’s.
In the next set of settings, I’ve left a lot of the defaults because this machine is purely for dev/test logging and doesn’t need to be part of any other virtual networks or work with any existing infrastructure. The settings that where changed are as follows:
On the Public IP Address blade I changed the address to be static and gave it a name that will be used later. seq-logger1 which is simple enough for our needs.
On the Network Security Group I created a new group and opened port 80 to allow HTTP traffic to the site. Make sure you don’t conflict with the priorities of the rules or you will get an error.
You will finally come to a summary page that will show you the details of all the setting you have configured. Once you click OK on this it will take a little while.
Once the machine is deployed you will be able to see it in the virtual machines list. Click on it and use the connect icon to download a remote desktop session connector.
We now want to set a DNS name s we can bind to it with seq. GO to the Public IP address section and click on the configuration blade to open the settings. Enter a name in the dns section and make a note of it.
Lets get on the box now.
Open the downloaded rdp session and enter the credentials you used when creating the machine. Make sure you set the machine name or I.P for the machine as the domain of the user otherwise you could have issues with domain conflict and user not found or passwords failing.
You will receive a notification about certificates and remote access this is fine. Click Don’t ask me again and then Yes.
Once logged in we will need to turn off the IE Enhanced Security Configuration so we can go out and get seq. This can be done my selecting Local Servers in the Server management console that appears of the first load. From there just select off for administrators
We also need to open up the machines firewall. We have exposed the machine port via Azure but we still need to go to Windows Firewall > Add inbound rule and add port 80 and maybes 443 if you are planning to use secure connection.
Next load up internet explorer and got to http://getseq.net then download the latest MSI which was 3.1.17 at the time of writing this.
From here run the installer selecting yes to the terms and then follow through with the default options taking note of where the location is for the files.
On the final screen untick the install seq service. We don’t want to do this just yet. If you wish to use the default port of 5431 then feel free to do this but you will need to open up the appropriate firewall rules and endpoints. As this server is purely for Seq we are going to stick with listening on port 80.
Go to the location of Seq in windows explorer and create a new folder called data.
Then click on the seq.Administration tool which will run the wizard for setting up the service. This could also be done from the command line for those who like that sort of thing. You can read more about it here http://docs.getseq.net/v3/docs/storage-paths-and-urls
Once the install is complete you will be able to see a green Browse Seq button (As long as all went well). Clicking this will bring up a browser and take you to the events screen.
A few things to note are the obvious security concerns of mass logging application data particularly as we haven’t used ssl. The other aspect is Seq’s security model means you would have to pay for a licence to have the ability to lock seq down on a per user basis. Seq is an amazing product and I highly recommend doing this but be careful that whilst you are on the trial version anybody with access to the machine can view seq.
In a future post I will sow you how to wire up MVC 6 so that you get full debugging to a Seq server.
Any constructive comments, points or criticisms would be greatly appreciated.