When adding the EcsTextFormatter for dotnet we have noticed it doesn't add newlines after each entry. This causes a few issues. First it is hard to read manually to determine when one log entry starts and another ends. Another issue if there is a few console outputs that isn't part of the logging such as the hosting provider startup that get appended to the end of the json output and not the next line since the ecs doesn't add it.
{"@timestamp":"2020-02-10T11:28:36.010901-06:00","log.level":"Information","message":"Starting web host","ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:36.010901-06:00"},"log":{"logger":"Elastic.CommonSchema.Serilog","original":null},"process":{"thread":{"id":1},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}WARNING: Only use the Vault LDAP Authentication Method when developing locally.
MyConnectionStringValue
{"@timestamp":"2020-02-10T11:28:37.292461-06:00","log.level":"Information","message":"User profile is available. Using '\"/Users/mitch.maler/.aspnet/DataProtection-Keys\"' as key repository; keys will not be encrypted at rest.","_metadata":{"full_name":"/Users/mitch.maler/.aspnet/DataProtection-Keys"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:37.292461-06:00"},"log":{"logger":"Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager","original":null},"process":{"thread":{"id":1},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}Hosting environment: Development
Content root path: /Users/mitch.maler/repos/sre-kubernetes-project-examples/aspnetcore-service-sample/Demo.Sample.WebApi
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
{"@timestamp":"2020-02-10T11:28:37.554143-06:00","log.level":"Information","message":"Request starting HTTP/1.1 GET http://localhost:5000/ ","_metadata":{"protocol":"HTTP/1.1","method":"GET","content_type":null,"content_length":null,"scheme":"http","path_base":"","path":"/","query_string":"","hosting_request_starting_log":"Request starting HTTP/1.1 GET http://localhost:5000/ ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MR:00000001","request_path":"/","span_id":"|fddaab66-424572f7a43c6ff4.","trace_id":"fddaab66-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MR"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:37.554143-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":8},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:37.621892-06:00","log.level":"Information","message":"Request finished in 70.4575ms 404 ","_metadata":{"elapsed_milliseconds":70.4575,"status_code":404,"content_type":null,"hosting_request_finished_log":"Request finished in 70.4575ms 404 ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MR:00000001","request_path":"/","span_id":"|fddaab66-424572f7a43c6ff4.","trace_id":"fddaab66-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MR"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:37.621892-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":8},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:37.926152-06:00","log.level":"Information","message":"Request starting HTTP/1.1 GET http://localhost:5000/ ","_metadata":{"protocol":"HTTP/1.1","method":"GET","content_type":null,"content_length":null,"scheme":"http","path_base":"","path":"/","query_string":"","hosting_request_starting_log":"Request starting HTTP/1.1 GET http://localhost:5000/ ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MS:00000001","request_path":"/","span_id":"|fddaab67-424572f7a43c6ff4.","trace_id":"fddaab67-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MS"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:37.926152-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":6},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:37.928062-06:00","log.level":"Information","message":"Request finished in 1.9781ms 404 ","_metadata":{"elapsed_milliseconds":1.9781,"status_code":404,"content_type":null,"hosting_request_finished_log":"Request finished in 1.9781ms 404 ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MS:00000001","request_path":"/","span_id":"|fddaab67-424572f7a43c6ff4.","trace_id":"fddaab67-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MS"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:37.928062-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":6},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:38.297684-06:00","log.level":"Information","message":"Request starting HTTP/1.1 GET http://localhost:5000/ ","_metadata":{"protocol":"HTTP/1.1","method":"GET","content_type":null,"content_length":null,"scheme":"http","path_base":"","path":"/","query_string":"","hosting_request_starting_log":"Request starting HTTP/1.1 GET http://localhost:5000/ ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MT:00000001","request_path":"/","span_id":"|fddaab68-424572f7a43c6ff4.","trace_id":"fddaab68-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MT"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:38.297684-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":10},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:38.301349-06:00","log.level":"Information","message":"Request finished in 3.2831ms 404 ","_metadata":{"elapsed_milliseconds":3.2831,"status_code":404,"content_type":null,"hosting_request_finished_log":"Request finished in 3.2831ms 404 ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MT:00000001","request_path":"/","span_id":"|fddaab68-424572f7a43c6ff4.","trace_id":"fddaab68-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MT"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:38.301349-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":10},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:38.664058-06:00","log.level":"Information","message":"Request starting HTTP/1.1 GET http://localhost:5000/ ","_metadata":{"protocol":"HTTP/1.1","method":"GET","content_type":null,"content_length":null,"scheme":"http","path_base":"","path":"/","query_string":"","hosting_request_starting_log":"Request starting HTTP/1.1 GET http://localhost:5000/ ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MU:00000001","request_path":"/","span_id":"|fddaab69-424572f7a43c6ff4.","trace_id":"fddaab69-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MU"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:38.664058-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":11},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:38.665668-06:00","log.level":"Information","message":"Request finished in 1.295ms 404 ","_metadata":{"elapsed_milliseconds":1.295,"status_code":404,"content_type":null,"hosting_request_finished_log":"Request finished in 1.295ms 404 ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MU:00000001","request_path":"/","span_id":"|fddaab69-424572f7a43c6ff4.","trace_id":"fddaab69-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MU"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:38.665668-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":11},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:38.985182-06:00","log.level":"Information","message":"Request starting HTTP/1.1 GET http://localhost:5000/ ","_metadata":{"protocol":"HTTP/1.1","method":"GET","content_type":null,"content_length":null,"scheme":"http","path_base":"","path":"/","query_string":"","hosting_request_starting_log":"Request starting HTTP/1.1 GET http://localhost:5000/ ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MV:00000001","request_path":"/","span_id":"|fddaab6a-424572f7a43c6ff4.","trace_id":"fddaab6a-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MV"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:38.985182-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":6},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:38.986888-06:00","log.level":"Information","message":"Request finished in 1.427ms 404 ","_metadata":{"elapsed_milliseconds":1.427,"status_code":404,"content_type":null,"hosting_request_finished_log":"Request finished in 1.427ms 404 ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0MV:00000001","request_path":"/","span_id":"|fddaab6a-424572f7a43c6ff4.","trace_id":"fddaab6a-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0MV"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:38.986888-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":6},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:39.342789-06:00","log.level":"Information","message":"Request starting HTTP/1.1 GET http://localhost:5000/ ","_metadata":{"protocol":"HTTP/1.1","method":"GET","content_type":null,"content_length":null,"scheme":"http","path_base":"","path":"/","query_string":"","hosting_request_starting_log":"Request starting HTTP/1.1 GET http://localhost:5000/ ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0N0:00000001","request_path":"/","span_id":"|fddaab6b-424572f7a43c6ff4.","trace_id":"fddaab6b-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0N0"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:39.342789-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":11},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:39.344394-06:00","log.level":"Information","message":"Request finished in 1.365ms 404 ","_metadata":{"elapsed_milliseconds":1.365,"status_code":404,"content_type":null,"hosting_request_finished_log":"Request finished in 1.365ms 404 ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0N0:00000001","request_path":"/","span_id":"|fddaab6b-424572f7a43c6ff4.","trace_id":"fddaab6b-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0N0"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:39.344394-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":11},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:39.710219-06:00","log.level":"Information","message":"Request starting HTTP/1.1 GET http://localhost:5000/ ","_metadata":{"protocol":"HTTP/1.1","method":"GET","content_type":null,"content_length":null,"scheme":"http","path_base":"","path":"/","query_string":"","hosting_request_starting_log":"Request starting HTTP/1.1 GET http://localhost:5000/ ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0N1:00000001","request_path":"/","span_id":"|fddaab6c-424572f7a43c6ff4.","trace_id":"fddaab6c-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0N1"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:39.710219-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":8},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:39.711554-06:00","log.level":"Information","message":"Request finished in 0.9139ms 404 ","_metadata":{"elapsed_milliseconds":0.9139,"status_code":404,"content_type":null,"hosting_request_finished_log":"Request finished in 0.9139ms 404 ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0N1:00000001","request_path":"/","span_id":"|fddaab6c-424572f7a43c6ff4.","trace_id":"fddaab6c-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0N1"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:39.711554-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":8},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:40.001856-06:00","log.level":"Information","message":"Request starting HTTP/1.1 GET http://localhost:5000/ ","_metadata":{"protocol":"HTTP/1.1","method":"GET","content_type":null,"content_length":null,"scheme":"http","path_base":"","path":"/","query_string":"","hosting_request_starting_log":"Request starting HTTP/1.1 GET http://localhost:5000/ ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0N2:00000001","request_path":"/","span_id":"|fddaab6d-424572f7a43c6ff4.","trace_id":"fddaab6d-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0N2"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:40.001856-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":6},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}{"@timestamp":"2020-02-10T11:28:40.002983-06:00","log.level":"Information","message":"Request finished in 0.8796ms 404 ","_metadata":{"elapsed_milliseconds":0.8796,"status_code":404,"content_type":null,"hosting_request_finished_log":"Request finished in 0.8796ms 404 ","event_id":{"properties":[{"name":"Id","value":{}}]},"request_id":"0HLTE9QKSD0N2:00000001","request_path":"/","span_id":"|fddaab6d-424572f7a43c6ff4.","trace_id":"fddaab6d-424572f7a43c6ff4","parent_id":"","connection_id":"0HLTE9QKSD0N2"},"ecs":{"version":"1.4.0"},"event":{"severity":2,"timezone":"Central Standard Time","created":"2020-02-10T11:28:40.002983-06:00"},"log":{"logger":"Microsoft.AspNetCore.Hosting.Diagnostics","original":null},"process":{"thread":{"id":6},"pid":79132,"name":"Demo.Sample.W","executable":"Demo.Sample.W","title":""}}