Tuesday, April 4, 2017

ORM for structured Logs

In the past I was told: Don't store logs in the database.

Time (and hardware) has changed.

I think it is time to store logs where I have great tools for analyzing logs.

Storing in a model which I can access via django orm is my current strategy.

It seems no one has done this before. I could not find such a project up to now.

My first draft looks like this:


class Log(models.Model):
datetime=models.DateTimeField(default=datetime.datetime.now, db_index=True)
data=jsonfield.JSONField()
host=models.CharField(max_length=256, default='localhost', db_index=True)
system=models.CharField(max_length=256, default='', db_index=True)

I am missing two things:

Missing1: Log level: INFO, WARN, ...

Missing2: A way to store exceptions.


What do you think?

What's wrong with this, what could be improved?

Regards,
Thomas Güttler





--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7094e0e8-a9f1-4435-a102-cea6d905c27b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment