{"id":30443514,"url":"https://github.com/holomodular/servicebricks-logging","last_synced_at":"2026-02-19T19:32:37.581Z","repository":{"id":236604438,"uuid":"792927451","full_name":"holomodular/ServiceBricks-Logging","owner":"holomodular","description":"ServiceBricks Logging Microservice - Centralized application and web request logging","archived":false,"fork":false,"pushed_at":"2025-12-14T14:35:55.000Z","size":1403,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-15T16:18:38.758Z","etag":null,"topics":["logging","servicebricks"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holomodular.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"holomodular"}},"created_at":"2024-04-28T00:12:37.000Z","updated_at":"2025-12-14T14:35:59.000Z","dependencies_parsed_at":"2024-06-05T06:46:12.611Z","dependency_job_id":"9556aaf2-17d1-482c-bea7-778b53a90583","html_url":"https://github.com/holomodular/ServiceBricks-Logging","commit_stats":null,"previous_names":["holomodular/servicebricks-logging"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/holomodular/ServiceBricks-Logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holomodular%2FServiceBricks-Logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holomodular%2FServiceBricks-Logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holomodular%2FServiceBricks-Logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holomodular%2FServiceBricks-Logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holomodular","download_url":"https://codeload.github.com/holomodular/ServiceBricks-Logging/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holomodular%2FServiceBricks-Logging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29628818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T18:02:07.722Z","status":"ssl_error","status_checked_at":"2026-02-19T18:01:46.144Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logging","servicebricks"],"created_at":"2025-08-23T09:20:18.170Z","updated_at":"2026-02-19T19:32:37.543Z","avatar_url":"https://github.com/holomodular.png","language":"C#","funding_links":["https://github.com/sponsors/holomodular"],"categories":[],"sub_categories":[],"readme":"![ServiceBricks Logo](https://github.com/holomodular/ServiceBricks/blob/main/Logo.png)  \n\n[![NuGet version](https://badge.fury.io/nu/ServiceBricks.Logging.Microservice.svg)](https://badge.fury.io/nu/ServiceBricks.Logging.Microservice)\n![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/holomodular-support/2214c3b2c703476cbafeb647eb655fc8/raw/servicebrickslogging-codecoverage.json)\n[![License: MIT](https://img.shields.io/badge/License-MIT-389DA0.svg)](https://opensource.org/licenses/MIT)\n\n# ServiceBricks Logging Microservice\n\n## Overview\n\nThis repository contains a logging microservice built using the ServiceBricks foundation.\nThe logging microservice provides logging support for any hosted application using the Microsoft.Extensions.Logging library.\nIt also provides web request logging functionality, so you can audit all url-based web requests and their properties coming into the application.\n\n\n## Data Transfer Objects\n\n### LogMessageDto - Admin Policy\nLogging message storage object.\n\n```csharp\n\npublic class LogMessageDto : DataTransferObject\n{\n    public virtual DateTimeOffset CreateDate { get; set; }\n    public virtual string Application { get; set; }\n    public virtual string Server { get; set; }\n    public virtual string Category { get; set; }\n    public virtual string UserStorageKey { get; set; }\n    public virtual string Path { get; set; }\n    public virtual string Level { get; set; }\n    public virtual string Message { get; set; }\n    public virtual string Exception { get; set; }\n    public virtual string Properties { get; set; }\n}\n\n```\n\n#### Business Rules\n\n* DomainCreateDateRule - CreateDate property\n\n### WebRequestMessageDto - Admin Policy\nUsed to store web request logging messages.\n\n```csharp\n\n public class WebRequestMessageDto : DataTransferObject\n {\n     public DateTimeOffset CreateDate { get; set; }\n     public string RequestIPAddress { get; set; }\n     public string RequestProtocol { get; set; }\n     public string RequestScheme { get; set; }\n     public string RequestMethod { get; set; }\n     public string RequestBody { get; set; }\n     public string RequestPath { get; set; }\n     public string RequestPathBase { get; set; }\n     public string RequestQueryString { get; set; }\n     public string RequestQuery { get; set; }\n     public string RequestRouteValues { get; set; }\n     public string RequestHost { get; set; }\n     public bool? RequestHasFormContentType { get; set; }\n     public string RequestCookies { get; set; }\n     public string RequestContentType { get; set; }\n     public long? RequestContentLength { get; set; }\n     public string RequestHeaders { get; set; }\n     public bool? RequestIsHttps { get; set; }\n     public string RequestUserId { get; set; }\n     public int? ResponseStatusCode { get; set; }\n     public string ResponseHeaders { get; set; }\n     public string ResponseCookies { get; set; }\n     public string ResponseContentType { get; set; }\n     public long? ResponseContentLength { get; set; }\n     public long? ResponseTotalMilliseconds { get; set; }\n     public string ResponseBody { get; set; }\n }\n\n```\n\n#### Business Rules\n\n* DomainCreateDateRule - CreateDate property\n\n\n## Background Tasks and Timers\n\n### LoggingWriteMessageTimer class\nThis background timer runs by default every 1 second, with an initial delay of 1 second. Executes the LoggingWriteMessageTask.\n\n[View Source](https://github.com/holomodular/ServiceBricks-Logging/blob/main/src/V1/ServiceBricks.Logging/BackgroundTask/LoggingWriteMessageTimer.cs)\n\n### LoggingWriteMessageTask class\nThis background task pulls records off of custom logger inmemory queue and writes them to the ILogMessageAPIService.\n\n[View Source](https://github.com/holomodular/ServiceBricks-Logging/blob/main/src/V1/ServiceBricks.Logging/BackgroundTask/LoggingWriteMessageTask.cs)\n\n## Events\nNone\n\n## Middleware\n\n### CustomLoggerMiddleware\nThis middleware is responsible for plugging into the pipeline and storing minimal HttpRequest information (such as user, request path, etc) to store along with log messages.\n\nIn your program.cs file, add the custom logger with **AddServiceBricksLogging()** in the ConfigureLogging section.\n```csharp\n\n    .ConfigureLogging((hostingContext, logging) =\u003e\n    {\n        logging.AddConfiguration(hostingContext.Configuration.GetSection(\"Logging\"));\n        logging.AddConsole();\n        logging.AddDebug();\n        logging.AddServiceBricksLogging();\n    })\n\n```\n\n\nThe following code should be added to your web application's startup. This middleware should be added to the pipeline after UseAuth(), so that any authenticated user is available.\n```csharp\n  app.UseMiddleware\u003cCustomLoggerMiddleware\u003e();\n```\n\n[View Source](https://github.com/holomodular/ServiceBricks-Logging/blob/main/src/V1/ServiceBricks.Logging/Middleware/CustomLoggerMiddleware.cs)\n\n### WebRequestMessageMiddleware class\nThis middleware is responsible for plugging into the pipeline and pulling the HttpRequest and HttpResponse properties of the current web request and storing them for auditing purposes.\n\nThe following code should be added to your web application's startup. \nThis middleware should be added to the pipeline after UseAuth(), so that any authenticated user is available.\n```csharp\n  app.UseMiddleware\u003cWebRequestMessageMiddleware\u003e();\n```\n[View Source](https://github.com/holomodular/ServiceBricks-Logging/blob/main/src/V1/ServiceBricks.Logging/Middleware/WebRequestMessageMiddleware.cs)\n\n## Processes\nNone\n\n## Service Bus\n\n### CreateApplicationLogBroadcast\nThis microservice subscribes to the CreateApplicationLogBroadcast message.\nIt is associated to the [CreateApplicationLogRule](https://github.com/holomodular/ServiceBricks-Logging/blob/main/src/V1/ServiceBricks.Logging/Rule/CreateApplicationLogRule.cs) Business Rule.\nWhen receiving the message, it will simply create a record in storage.\n```csharp\n\npublic class CreateApplicationLogBroadcast : DomainBroadcast\u003cApplicationLogDto\u003e\n{\n    public CreateApplicationLogBroadcast(ApplicationLogDto obj)\n    {\n        DomainObject = obj;\n    }\n}\n\n```\n\n## Additional\nNone\n\n## Application Settings\n\n```json\n{    \n  \"Logging\": {\n    \"LogLevel\": {\n      // Specify custom logging levels for components here\n      \"Default\": \"Information\",\n      \"Microsoft\": \"Warning\",\n      \"Microsoft.AspNetCore\": \"Warning\",\n      \"Microsoft.Hosting.Lifetime\": \"Warning\"\n    }\n  },\n\n  // ServiceBricks Root Configuration\n  \"ServiceBricks\": {\n\n    // Logging Microservice Settings\n    \"Logging\": {\n\n      // WebRequestMessageMiddleware options\n      \"WebRequestMessage\": {\n        \"EnableLogging\": true,\n        \"EnableLocalIpRequests\": true,\n        \"EnableRequestIPAddress\": true,\n        \"EnableRequestBody\": false,\n        \"EnableRequestBodyOnError\": true,\n        \"EnableRequestProtocol\": true,\n        \"EnableRequestScheme\": true,\n        \"EnableRequestMethod\": true,\n        \"EnableRequestPath\": true,\n        \"EnableRequestPathBase\": true,\n        \"EnableRequestQueryString\": true,\n        \"EnableRequestQuery\": false,\n        \"EnableRequestRouteValues\": false,\n        \"EnableRequestHost\": false,\n        \"EnableRequestHasFormContentType\": true,\n        \"EnableRequestCookies\": false,\n        \"EnableRequestContentType\": true,\n        \"EnableRequestContentLength\": true,\n        \"EnableRequestHeaders\": false,\n        \"EnableRequestIsHttps\": true,\n        \"EnableRequestUserId\": true,\n        \"EnableResponseStatusCode\": true,\n        \"EnableResponseHeaders\": false,\n        \"EnableResponseCookies\": false,\n        \"EnableResponseContentType\": true,\n        \"EnableResponseContentLength\": true,\n        \"EnableResponseTotalMilliseconds\": true,\n        \"EnableResponseBody\": false,\n        \"EnableExcludeRequestPaths\": true,\n        \"ExcludeRequestPaths\": [\n          \"/css/\",\n          \"/img/\",\n          \"/js/\",\n          \"/lib/\",\n          \"/webfonts/\"\n        ]\n      }\n    }\n  }\n}\n```\n\n\n\n# About ServiceBricks\n\nServiceBricks is the cornerstone for building a microservices foundation.\nVisit http://ServiceBricks.com to learn more.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholomodular%2Fservicebricks-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholomodular%2Fservicebricks-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholomodular%2Fservicebricks-logging/lists"}