lambdaspace / pfCounter

A script that gets connected devices in a network, from a pfSense Router.
MIT License
3 stars 1 forks source link

Generate and store logs #5

Open alexdor opened 7 years ago

alexdor commented 7 years ago

PfCounter should generate and store logs. I don't know if python has a proper implementation for storing app logs to system's logs. We could, probably, use logger though.

wandeg commented 7 years ago

The python logging module can be used to generate the logs.

panagiks commented 7 years ago

@alexdor why write at the system logs? Also using logger will make it OS specific (as soon as we solve #4 the script will be able to run on any OS with Python installed). I've already implemented a basic logging mechanism for RSPET, we can take this to use it out of the box asap and once we get a bit of free time migrate to @wandeg 's suggestion of the logging module.

alexdor commented 7 years ago

Because it's easier to manage logs, from a sysadmin's standpoint, when they are centralized. But keeping it platform agnostic is important so let's use your implementation.

Canuteson commented 7 years ago

It might also be better just to log to stdout. You can use logger as @panagiks suggested.

Then you decide where to send standard out when you run the script. This is commonly done in cron and init/upstart scripts. It makes the application not care where the logs go, which is a nice pattern.

panagiks commented 7 years ago

@alexdor would it be easy for you to make a list of the things you think that should be logged?

alexdor commented 7 years ago

Sure, when debugging flag is enabled, everything should be logged (published message as well as the verbose answer from the broker). When the flag is disabled, it should only log failures (unable to publish, connection refused, unable to log in etc.). Timestamps would be nice as well.