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



Considerations when using SEQ as AuditLog

We have been considering the Pros and Cons of using SEQ as the repository for our AuditLog. I have read a few questions in this forum (eg. [This] ( and [This]( ). However I still have a few questions: **What's the difference between WriteTo and AuditTo?** Assuming that the SEQ server and the connection to the SEQ server doesn't go down - I would guess that WriteTo still maintains the same sequence of events as AuditTo? Or that this problem could be solved using a timestamp generated in the client code? As far as I have understood this - just using WriteTo and not generating the 'auditing timestamp' - but relying on the SEQ server timestamp will actually be a problem for the sequence? **Is there a difference with exceptions, when using WriteTo and AuditTo?** In one of the previous post - answers you wrote: > AuditTo has the advantage of logging synchronously and propagating any exceptions, > but of course comes with a corresponding performance cost. You could use a second > server and WriteTo if guaranteed audit logging isn't a strict requirement. Could you try and explain this in a bit more detail? **Is performance good enough?** When sending both regular 'warnings and errors' to SEQ the number should be pretty low, but including an audit trail for each user severily increases the number of events sent to SEQ. Do you have a kind of 'formula' to use when trying to estimate disc usage and other HW specs? The reason I'm asking is that it could be a requirement to keep this kind of data between 1-5 years and I'm kind of worried that disc space especially could be an issue - because the auditlog cannot be deleted and it should also still be searchable. **Could you perhaps add a seperate documentation section about using SEQ as AuditLog?** SEQ has many advantages and I'm assuming that we are not the first ones considering to use SEQ as a audit log repo - it might be worth it to keep a seperate link on the documentation page about this. Just describing those 'special concerns' that needs to be thought about when using SEQ for this fairly important log.

Posted by Allan 2 years ago


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 years ago