I'm writing a piece of honeypot software that will have extensive logging of interactions with it, I plan to log in plaintext .log
files.
I have two questions, from someone who isn't too familiar with how servers log.
Firstly how shall I break up my log files, I'm assuming after running this for a month I don't want one big .log
file, do I do this by day, month, year? Is there some standard for it?
The format of each line, do I have one standard delimiter that is whatever, *, -, +, anything? Is there a standard anywhere (my googling hasn't brought up much)?
I like this format for log files:
$ python simple_logging_module.py 2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message 2005-03-19 15:10:26,620 - simple_example - INFO - info message 2005-03-19 15:10:26,695 - simple_example - WARNING - warn message 2005-03-19 15:10:26,697 - simple_example - ERROR - error message 2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message
This is from python's logging module. I usually have a file per day, one folder for each month, one folder for each year. You'll get huge log files that you can't edit properly otherwise.
logs/ 2009/ January/ 01012009.log 02012009.log ... February/ ... 2008/ ...
There is no standard for such a logging. And rolling, layout of files, it all depends on what you need. In general I have faced 3 main scenarios:
log4anything
packages.YYYYMMDD
. If you don't stage your logs consider directory layout like YYYY\MM\YYYYMMDD as shown in other answers.logfile_yyyymmdd_ccc.log
where ccc
is increasing number. Adding time to file name is also a good idea (eg. to easily judge how many logs per minute you are generating)UNIX
text tools.This custom one looked like this
logs/ 20090101/ logfile_20090101_001.zip logfile_20090101_002.zip ... 20090102/ logfile_20090102_001.zip logfile_20090102_002.zip logfile_20090101_001.log logfile_20090101_002.log logfile_20090102_001.log logfile_20090102_002.log
There is also some bunch of good practices for good logging:
Excel
. If it takes longer than 30 seconds it means your logging is wrong. This includes: Unix
text tools and with Excel
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With