I'd like take a few minutes this morning and introduce my first open source project, KLog.
My goal with KLog is to create a central, easy to install, developer focused logging platform. The motivation came from 3 main areas:
- I wanted a central, easy to use, shared logging point for personal applications I was developing.
- At companies I worked for, having a centralized, visual logging and alerting platform for our applications would have been beneficial.
Existing solutions I looked at were either:
a) Geared toward infrastructure monitoring
b) Designed for large and/or complex enterprise environments
c) Cloud based, where I didn't truly own the data or control the retention policy
Source and Documentation
All of the source code for KLog can be found on GitHub
If you'd like to view the official documentation, you can do so here
Design and Technology
When designing KLog, I wanted something that could have an initial version working within a couple weeks, was simple to install, and easy to modify.
Based on that, I decided to build the frontend with React, while using .Net 6 for the the API. For database integration, I'm utilizing EFCore and Microsoft SQL.
In order to have a live log feed, I utilized SignalR, which will also power real-time dashboards later in development.
In terms of hosting and deployment, the API has static file support enabled. What this means is that the React app is built, and files from the build directory are copied over to the wwwroot directory of the API. Deployment is as easy as updating the appsettings.json file and copying the API build files to a directory served by IIS.
KLog's has a small, but helpful set of initial features including:
- Account creation
- The ability to create and delete API keys
- A searchable and filterable live feed for incoming logs
- An investigation / search area
- An easily configurable GitHub integration for receiving webhooks
As development continues, I plan on adding additional features, such as support for multiple database types, configurable alerting via text / email / IM, a monitoring system, and live dashboards.
Account creation is straight forward. Simply click the "register" button at the login screen, type in a username and password, and click register. You'll automatically be logged in and ready to go.
API Key management
In order to post logs from other applications, you need to create an API Key. In addition, each application should have its own key. This helps with keeping everything separate, as well as simplifying the search process.
Live Log Feed
The Log Feed displays a scrolling, searchable list of events, and updates in real time as additional logs come in. You can change the fields that are displayed, as well as the search parameters via the search bar at the bottom of the screen.
The investigation area is similar to the log feed in that it can be used to search and filter through logs. The main difference is that you can search through all logs in the system, as opposed to just those displaying on the screen. You can also specify the application or api key as search criteria to narrow results even more.
KLog has a built-in endpoint for receiving GitHub webhooks, so all you have to do to get started is create an API Key called "GitHub" and use the identifier as the secret key when creating a github webhook. Of course, you have to specify the endpoint as well.
Setup is relatively simple, and can be done via code or the pre-built binaries (currently windows only). If using the built application from the GitHub release, all you need to do is add your information in the appsettings.production.json, add an ASPNETCORE_ENVIRONMENT=Production environment variable, and serve the application via IIS. Detailed instructions can be found here.
So there you have it - My first attempt at an open source project. Hopefully it helps someone out, and I'd love to hear any feedback or suggestions. If you do decide to try it, or even just look at it, let me know what you think in the comments!