Comments (4)
So I have done a bunch of reading on this and I think we can do this two ways
-
We write our own logger that when it reaches 10 minutes it Closes the file, renames, and then opens a new file. Then resumes logging.
-
We use linux os level logrotate, the issue with this is that "Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost." We would have to have the script looking for a signal from logrotate to stop writing to the file handle and then resume after rotation is complete. Then we just have a cronjob that runs logrotate every 10 minutes.
Thoughts?
from netsarlacc.
If we use an OS-level log rotation tool we still have to signal the sinkhole to flush and close the file and then signal it again when it should open a new log. That's messy. The primary feature of this tool is logging so we should put effort into making sure the logging is done right.
I don't think we need to do any renaming at all. Let's just use the build the timestamp into the file name from the start. Something like netsarlacc-201703292100.log and then the next ones would be netsarlacc-201703292110.log, netsarlacc-201703292120.log, etc.
I suppose we could start by opening netsarlacc-201703292100.tmp and then when we close to open another, we move it to netsarlacc-201703292100.log.
Opening and closing files is simple. I don't see why we wouldn't do it in our own code.
from netsarlacc.
put in pull request, think I have solved this issue and issue #13
from netsarlacc.
This has been fixed with the new logging code.
from netsarlacc.
Related Issues (20)
- Parameterize and CONSTize many magic values / strings / paths HOT 1
- Code should accept a path via cmdline / config and not assume working in '.' HOT 1
- Get socket handles and then drop privs by passing handles through daemon HOT 1
- Factor out template code and try to re-use some work between invocations HOT 2
- Moar, better, updated docs, readme, examples
- Consider decoupling reading from socket and the parsing, logging of HTTP, and sending responses HOT 1
- Need to audit usage of time for timezone correctness HOT 1
- Move the worker stopping code into the dispatcher file HOT 1
- Move the stopping of the logger into the logger.go file HOT 1
- Collapse the starting of the ReadWorkers and normal workers into one start function HOT 1
- init scripts
- Look into increasing TCP backlock on listening socket HOT 1
- Possibily record TLS SNI if the client uses it HOT 2
- Possibly record version of TLS negoiated
- Rework socket read() calls to do more than one HOT 1
- Move global configuration vars to a config struct
- Explore making protocol handlers more modular
- IPv6 support
- Add build versioning / version number
- Add generic "listen" protocol.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netsarlacc.