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

podman events output jsonlines #3159

Closed
muayyad-alsadi opened this issue May 19, 2019 · 3 comments · Fixed by #3171
Closed

podman events output jsonlines #3159

muayyad-alsadi opened this issue May 19, 2019 · 3 comments · Fixed by #3171
Assignees
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@muayyad-alsadi
Copy link
Contributor

/kind feature

Description

to make parsing podman events I need it to be in jsonlines (aka ndjson)

current output

$ podman events
2019-05-19 12:19:13.962020795 +0300 EEST container init 0c3b587013968ce5adc5f2dcbbcfd691c3f162bf43798f885d89769c68529d92 (image=docker.io/library/busybox:latest, name=my)
2019-05-19 12:19:14.086438455 +0300 EEST container start 0c3b587013968ce5adc5f2dcbbcfd691c3f162bf43798f885d89769c68529d92 (image=docker.io/library/busybox:latest, name=my)
2019-05-19 12:19:46.604928881 +0300 EEST container create 4871dacac25d09b95a00e3a72111c6813fa4e46941afdfe52b074c6e60f83072 (image=docker.io/library/busybox:latest, name=tender_mclaren)
2019-05-19 12:21:11.308193704 +0300 EEST container init 4871dacac25d09b95a00e3a72111c6813fa4e46941afdfe52b074c6e60f83072 (image=docker.io/library/busybox:latest, name=tender_mclaren)
2019-05-19 12:21:11.308565427 +0300 EEST container attach 4871dacac25d09b95a00e3a72111c6813fa4e46941afdfe52b074c6e60f83072 (image=docker.io/library/busybox:latest, name=tender_mclaren)
2019-05-19 12:21:11.357720034 +0300 EEST container start 4871dacac25d09b95a00e3a72111c6813fa4e46941afdfe52b074c6e60f83072 (image=docker.io/library/busybox:latest, name=tender_mclaren)

it seems there is no way to make it json

$ man podman events
...
--format
       Format the output using the given Go template.  An output value of json is not supported.

if you just dump a json per line with whatever internal format might work, but something like this would be better

{"time": 123, "kind": "container", "status":"start", "container_id":"123ee",  "from": "busybox", ...}
{"time": 123, "kind": "pod": "status":"start", "pod_id":"321aa", ...}
@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label May 19, 2019
@baude baude self-assigned this May 19, 2019
@baude
Copy link
Member

baude commented May 19, 2019

can you elaborate on why you want this? how will it be used? whats the use case?

@muayyad-alsadi
Copy link
Contributor Author

a readline loop that listen to those events
and when a new container is up or down load-balancer (haproxy) configuration is updated based on template to expose it to some subdomain based on some label

like docker-balancer or docker-glue

something like this

podman run -d --name wp1 -l glue.subdomain='wp1' mywordpress/wordpress 
podman run -d --name wp2 -l glue.subdomain='wp2' mywordpress/wordpress 
curl wp1.myuser.example.com/
curl wp2.myuser.example.com/

@rhatdan
Copy link
Member

rhatdan commented May 20, 2019

Seems like a reasonable request.

@rhatdan rhatdan added the Good First Issue This issue would be a good issue for a first time contributor to undertake. label May 20, 2019
@rhatdan rhatdan assigned weirdwiz and QiWang19 and unassigned baude May 20, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants