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

Possibility to extract parts of a json-message. #271

Merged
merged 3 commits into from Jul 14, 2023

Conversation

opensource21
Copy link
Contributor

Added the possibility to extract parts of a given json.

@tksm
Copy link
Contributor

tksm commented Jul 10, 2023

@opensource21 Hi, thank you for the PR.

Could you provide an example of the log and its expected output? I'm not entirely clear on the specific use case for this PR.

@opensource21
Copy link
Contributor Author

If you log for ELK-Stack the log looks like this with stern k5s-open-id-sync-operator --tail 1 --no-follow -A --template '{{.PodName}} | {{.Message}}{{"\n"}}'

+ middleware k5s-open-id-sync-operator-7b658c4694-tjksw › k5s-open-id-sync-operator
k5s-open-id-sync-operator-7b658c4694-tjksw | {"@timestamp":"2023-07-10T16:26:21.389Z","ecs.version":"1.2.0","log.level":"ERROR","message":"Exhausted retries for ExecutionScope{ resource id: ResourceID{name='k5s-config-server', namespace='middleware'}, version: 1432}","process.thread.name":"ReconcilerExecutor-serviceaccountreconciler-74","log.logger":"io.javaoperatorsdk.operator.processing.event.EventProcessor","resource.apiVersion":"v1","resource.kind":"ServiceAccount","resource.name":"k5s-config-server","resource.namespace":"middleware","resource.resourceVersion":"1432","resource.uid":"55428d6d-ab2a-43cc-9f3a-b2343c3d60b3","service.name":"k5s-open-id-sync-operator","service.version":"1.0.0"}
- middleware k5s-open-id-sync-operator-7b658c4694-tjksw › k5s-open-id-sync-operator

With mystern k5s-open-id-sync-operator --tail 1 --no-follow -A --template '{{.PodName}} | {{tryExtractJSONParts .Message "message" "service.name"}}{{"\n"}}' it looks

+ middleware k5s-open-id-sync-operator-7b658c4694-tjksw › k5s-open-id-sync-operator
k5s-open-id-sync-operator-7b658c4694-tjksw | Exhausted retries for ExecutionScope{ resource id: ResourceID{name='k5s-config-server', namespace='middleware'}, version: 1432}, k5s-open-id-sync-operator
- middleware k5s-open-id-sync-operator-7b658c4694-tjksw › k5s-open-id-sync-operator

I hope this makes it more clear

@tksm
Copy link
Contributor

tksm commented Jul 10, 2023

Thank you for the explanation! Now I understand the use-case of these helpers.

cmd/cmd.go Outdated Show resolved Hide resolved
cmd/cmd.go Outdated Show resolved Hide resolved
cmd/cmd.go Outdated Show resolved Hide resolved
cmd/cmd.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Co-authored-by: Takashi Kusumi <tkusumi@zlab.co.jp>
Copy link
Contributor

@tksm tksm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tksm tksm merged commit d49142c into stern:master Jul 14, 2023
2 checks passed
@opensource21
Copy link
Contributor Author

Thanks for the great support. Any timeline for the next release?

@tksm
Copy link
Contributor

tksm commented Jul 18, 2023

Thank you for your contribution!
Normally, we release updates in sync with Kubernetes minor releases. The next version is planned to be released after Kubernetes v1.28.0, which is expected to be out within one or two months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants