Thursday, April 6, 2017

Re: ORM for structured Logs

Hello Brick Wall, how are you doing?

Am Dienstag, 4. April 2017 14:18:42 UTC+2 schrieb guettli:
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/c8742484-a252-4c05-939a-f7c3f2b4f505%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment