Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration option to output logs in logfmt #1022

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

azuredream
Copy link

See more disscussion:
redis/redis#12934

Add ability to configure Redis to output logs in logfmt (See https://brandur.org/logfmt) as well as configure timestamp format options to more standard ISO 8601 or unix timestamp.

This change is implemented by two configs:
log-format: Either default or logfmt.
log-timestamp-format: default, iso8601, or unix.

#1006

$ ./valkey-server  /home/zhaoz12/git/valkey/valkey/valkey.conf
pid=109463 role=RDB/AOF timestamp="2024-09-10T20:37:25.738-04:00" level=warning message="WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect."
pid=109463 role=RDB/AOF timestamp="2024-09-10T20:37:25.738-04:00" level=notice message="oO0OoO0OoO0Oo Valkey is starting oO0OoO0OoO0Oo"
pid=109463 role=RDB/AOF timestamp="2024-09-10T20:37:25.738-04:00" level=notice message="Valkey version=255.255.255, bits=64, commit=affbea5d, modified=1, pid=109463, just started"
pid=109463 role=RDB/AOF timestamp="2024-09-10T20:37:25.738-04:00" level=notice message="Configuration loaded"
pid=109463 role=master timestamp="2024-09-10T20:37:25.738-04:00" level=notice message="monotonic clock: POSIX clock_gettime"
pid=109463 role=master timestamp="2024-09-10T20:37:25.739-04:00" level=warning message="Failed to write PID file: Permission denied"

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 20 lines in your changes missing coverage. Please review.

Project coverage is 70.40%. Comparing base (fa348e2) to head (2253944).
Report is 11 commits behind head on unstable.

Files with missing lines Patch % Lines
src/server.c 42.85% 20 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1022      +/-   ##
============================================
- Coverage     70.57%   70.40%   -0.18%     
============================================
  Files           114      114              
  Lines         61660    61690      +30     
============================================
- Hits          43515    43431      -84     
- Misses        18145    18259     +114     
Files with missing lines Coverage Δ
src/config.c 78.69% <ø> (ø)
src/server.h 100.00% <ø> (ø)
src/server.c 88.07% <42.85%> (-0.53%) ⬇️

... and 10 files with indirect coverage changes

@madolson
Copy link
Member

😀 thanks for opening this, we're working on launching the next version but will take a look shortly.

@PingXie
Copy link
Member

PingXie commented Sep 12, 2024

I like this change. Free-form log lines can be tricky to parse and search, and this feels like a good step toward adopting more structured logging. We could even extend it further to include properties like "area" (e.g., "cluster," "normal replication," "dual channel replication," etc.). Thanks for your work on this, @azuredream!

@madolson madolson added the major-decision-pending Major decision pending by TSC team label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-decision-pending Major decision pending by TSC team
Projects
Status: Candidate for release
Development

Successfully merging this pull request may close these issues.

3 participants