memcached: Including timestamps in Memcached error logs
Hi,
We found that memcached logs is done via fprintf()
and perror()
and each line of log doesn’t have a timestamp. This is an inconvenience for operators when troubleshooting. So questions here are:
-
Do we plan to add timestamps to memcached logs in the near future? i.e. use a better shaped “logger” instead of
fprintf
/perror
or with some other mechanism? -
Has anyone asked for this before? If so, what was the reason we didn’t do it?
p.s. If we are okay with fixing this, I can help with the implementation.
Thanks
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 21 (15 by maintainers)
Well to summarize:
/usr/bin/memcached -d -p 11211 -U 11211 -v -P /memcached/pid/memcached-11211.pid -m '53984' | ts '[%Y-%m-%d %H:%M:%S]' >> /memcached/log/memcached.log 2>&1
and getting what you want. or a perl one liner, or an awk one liner, or etc. Especially if you only rarely have log lines.(edit: wait?
-d
? it’s going to fork off and close/reopen its stderr/stdouts? you should only get startup log lines for that)