How to get the specific key modified through consul watch keyprefix.
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
KV:
key: configs/v1/test/test1 value: 111
key: configs/v1/test/test2 value: 222
script:
#!/usr/bin/env sh
while read line
do
echo "line: "$line
done
command:
consul watch -type keyprefix -prefix configs/v1/test /home/superman/consul-watch-test.sh
RUN result:
line: [{"Key":"configs/v1/test/","CreateIndex":3133811,"ModifyIndex":3133811,"LockIndex":0,"Flags":0,"Value":null,"Session":""},{"Key":"configs/v1/test/test1","CreateIndex":3133815,"ModifyIndex":3133815,"LockIndex":0,"Flags":0,"Value":"MTEx","Session":""},{"Key":"configs/v1/test/test2","CreateIndex":3133817,"ModifyIndex":3133817,"LockIndex":0,"Flags":0,"Value":"MjIyMnNk","Session":""}]
If I only modify the values of test2, it still returns all:
line: [{"Key":"configs/v1/test/","CreateIndex":3133811,"ModifyIndex":3133811,"LockIndex":0,"Flags":0,"Value":null,"Session":""},{"Key":"configs/v1/test/test1","CreateIndex":3133815,"ModifyIndex":3133815,"LockIndex":0,"Flags":0,"Value":"MTEx","Session":""},{"Key":"configs/v1/test/test2","CreateIndex":3133817,"ModifyIndex":3133826,"LockIndex":0,"Flags":0,"Value":"c2RmYWQ=","Session":""}]
How can I get only the modified value?(Contains: add, modify, delete)
Contributor guide
Research direction
Start with the provided consul watch -type keyprefix command and /home/superman/consul-watch-test.sh script, then inspect how keyprefix watch results are defined and delivered. Determine whether add, modify, and delete events can be isolated by the command; done means documenting the supported behavior or identifying the relevant change needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100