Seq Documentation and Support

Seq Documentation and Support

Welcome to the Seq documentation hub. You'll find comprehensive guides and documentation to help you start working with Seq as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    
Ask A Question



Using Seq for Python with Flask

I have the code below to configure the project to log to seq. Which was copy and pasted from the documentation. ''' import json import logging from flask import Flask from config import Config import seqlog app = Flask(__name__) app.config.from_object(Config) seqlog.log_to_seq( server_url="http://***:5341/", api_key="***", level=logging.DEBUG, batch_size=5, auto_flush_timeout=2, # seconds override_root_logger=True, json_encoder_class=json.encoder.JSONEncoder ) import views ''' When the app starts i get the following error: ''' FLASK_APP = FLASK_ENV = development FLASK_DEBUG = 0 In folder /Users/kelvinmacartney/PycharmProjects/comp-2011-cwk-2 /Users/kelvinmacartney/PycharmProjects/comp-2011-cwk-2/venv/bin/python -m flask run * Serving Flask app "" * Environment: development * Debug mode: off /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sqlalchemy/ext/declarative/ SAWarning: Attribute 'username' on class <class 'models.User'> appears to be a non-schema 'sqlalchemy.sql.column()' object; this won't be part of the declarative mapping (key, cls)) /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sqlalchemy/ext/declarative/ SAWarning: Attribute 'email' on class <class 'models.User'> appears to be a non-schema 'sqlalchemy.sql.column()' object; this won't be part of the declarative mapping (key, cls)) Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/", line 917, in _bootstrap_inner File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/", line 1158, in run self.function(*self.args, **self.kwargs) File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/seqlog/", line 67, in flush self.callback(current_batch) File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/seqlog/", line 366, in publish_log_batch request_body_json = json.dumps(request_body, cls=self.json_encoder_class) File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/", line 238, in dumps **kw).encode(obj) File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/", line 257, in iterencode return _iterencode(o, 0) File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type ColumnSet is not JSON serializable ''' The site runs fine, but when i try to log i get an exception. Is there something i'm missing?

Posted by Kelvin Macartney 2 months ago


NullReferenceException in response when Seqlog posts to the raw events end-point

Hi. I'm the maintainer of the [Seqlog]( library for Python. I only have a license for Seq 4.x so I haven't tried this myself, but [from what users tell me](, it seems that something has changed in Seq 5.x and when they attempt to use it with the latest version they see the following error (with an HTTP 500 from Seq): ```json { "@t": "2018-11-18T06:10:09.6170577Z", "@mt": "HTTP {RequestMethod} {RequestPath} responded {StatusCode} in {Elapsed:0.0000} ms", "@r": ["0.6036"], "@l": "Error", "@x": "System.NullReferenceException: Object reference not set to an instance of an object.\n at Seq.Server.Web.Api.RawEventsController.TryParseBody(ApiKey apiKey, StorageEventCreationData[]& events, String& errorMessage)\n at Seq.Server.Web.Api.RawEventsController.Ingest()\n at lambda_method(Closure , Object , Object[] )\n at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()\n at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)\n at Seq.Server.Web.Middleware.WebSocketAcceptMiddleware.Invoke(HttpContext context)\n at Seq.Server.Web.Middleware.RequestAuthenticationMiddleware.Invoke(HttpContext httpContext)\n at Seq.Server.Web.Middleware.BrowserSecurityOptionsMiddleware.Invoke(HttpContext context)\n at Seq.Server.Web.Middleware.RequestCompletionMiddleware.Invoke(HttpContext httpContext)", "RequestMethod": "POST", "RequestPath": "/api/events/raw", "StatusCode": 500, "Elapsed": 0.6036, "ErrorToken": "b2c14ff04fbc42348e951aec12f7f637", "RequestProtocol": "HTTP/1.1", "RequestHost": "localhost:5341", "RequestHeaders": { "User-Agent": "python-requests/2.18.4", "Content-Length": "1103" }, "SourceContext": "Seq.Server.Web.Middleware.RequestCompletionMiddleware", "RequestId": "0HLIC0HN27AR5:00000001", "CorrelationId": null, "ConnectionId": "0HLIC0HN27AR5" } ``` The request body is: ```json { "Events": [ { "Timestamp": "2018-11-17 09:05:47.256725+02:00", "Level": "INFO", "MessageTemplate": "Hi, {name}. {greeting}", "Properties": { "MachineName": "IL-GZigelman", "ProcessId": 17860, "LoggerName": "root", "name": "Root logger", "greeting": "Nice to meet you", "ThreadId": 20616, "ThreadName": "MainThread" } }, { "Timestamp": "2018-11-17 09:05:47.256725+02:00", "Level": "INFO", "MessageTemplate": "Hi, {name}! {greeting}", "Properties": { "MachineName": "IL-GZigelman", "ProcessId": 17860, "LoggerName": "A", "name": "world", "greeting": "Nice to meet you", "ThreadId": 20616, "ThreadName": "MainThread" } }, { "Timestamp": "2018-11-17 09:05:47.256725+02:00", "Level": "INFO", "MessageTemplate": "Bye, {name}! {greeting}", "Properties": { "MachineName": "IL-GZigelman", "ProcessId": 17860, "LoggerName": "A.B", "name": "moon", "greeting": "Nice to meet you", "ThreadId": 20616, "ThreadName": "MainThread" } }, { "Timestamp": "2018-11-17 09:05:47.256725+02:00", "Level": "INFO", "MessageTemplate": "By, moon!", "Properties": { "MachineName": "IL-GZigelman", "ProcessId": 17860, "LoggerName": "C", "0": "moon" } } ] } ```

Posted by Adam Friedman 3 months ago


Is NLog Exception layout renderer supported?

Seq version: 5.0.2296 NLog version: 4.5.11 NLog.Targets.Seq version: 1.0.0 Hi! I'm using NLog integration, everything works perfect. I'm logging exceptions with this syntax, as explained here: logger.Error(ex, ex.Message); This causes the full exception showed in Seq dashboard, which is what I needed: Now I want to make sure the inner exceptions to be included in that information, so I wanted to add this Exception layout renderer: ${exception:format=toString,Data:maxInnerExceptionLevel=10} as explained here: In a plain NLog configuration file, I would add that Exception Layout Rendered like this: <targets> <target name="f" type="File" layout="${longdate} ${message} ${exception:format=tostring}"/> </targets> But I have tried adding it to my Seq target tags, and the logs are not written. My actual targets definition is: <targets> <target name="seq" xsi:type="BufferingWrapper" bufferSize="1000" flushTimeout="2000" > <target xsi:type="Seq" serverUrl="http://localhost:5341" apiKey="" > <property name="application" value="${appdomain:format={1\}" /> <property name="class" value="${callsite:className=true:fileName=false:includeSourcePath=false:methodName=false}" /> <property name="method" value="${callsite:className=false:fileName=false:includeSourcePath=false:methodName=true}" /> </target> </target> </targets>

Posted by Carolina 3 months ago