-
Task
-
Resolution: Done
-
Normal
-
Logging 5.2
-
None
-
3
-
undefined
Peer review by abrennan_.
Add the following examples:
Sergey Yedrikov 11:41 PM
Here's the example for groupBy: namespaceName. The wording is just colloquial, the building blocks are the same as before. crc-5br8f here is mycluster-7977k in the docs.Create a new project 'app':
$ oc new-project appRun a Pod in it:
$ oc run busybox --image=busybox – sh -c 'while true; do echo "My life is my message"; sleep 3; done'
$ oc logs -f busybox
My life is my message
...List the log groups, "crc-5br8f.app" is the log group for the app project:
$ aws --output json logs describe-log-groups | jq .logGroups[].logGroupName
"crc-5br8f.app"
"crc-5br8f.audit"
"crc-5br8f.infrastructure"List the log streams in the "crc-5br8f.app" log group:
$ aws --output json logs describe-log-streams --log-group-name crc-5br8f.app | jq .logStreams[].logStreamName
"kubernetes.var.log.containers.busybox_app_busybox-58e0e8c1d139cebb12f541094ae6d76f244d41588fbbe9d4215e06e806f0bd19.log"Now remove the app project, together with the Pod running in it:
$ oc delete project/appList the log groups, the "crc-5br8f.app" log group is still there...
$ aws --output json logs describe-log-groups | jq .logGroups[].logGroupName
"crc-5br8f.app"
"crc-5br8f.audit"
"crc-5br8f.infrastructure"...together with the log stream from the now destroyed busybox Pod:
$ aws --output json logs describe-log-streams --log-group-name crc-5br8f.app | jq .logStreams[].logStreamName
"kubernetes.var.log.containers.busybox_app_busybox-58e0e8c1d139cebb12f541094ae6d76f244d41588fbbe9d4215e06e806f0bd19.log"Create the app project again and deploy a busybox Pod into it:
$ oc new-project app
$ oc run busybox --image=busybox – sh -c 'while true; do echo "My life is my message"; sleep 3; done'
$ oc logs -f busybox
My life is my message
...List the log groups, "crc-5br8f.app" is still the log group for the app project:
$ aws --output json logs describe-log-groups | jq .logGroups[].logGroupName
"crc-5br8f.app"
"crc-5br8f.audit"
"crc-5br8f.infrastructure"List the log streams in the "crc-5br8f.app" log group, note there's now a second log stream, for the new incarnation of the busybox Pod:
$ aws --output json logs describe-log-streams --log-group-name crc-5br8f.app | jq .logStreams[].logStreamName
"kubernetes.var.log.containers.busybox_app_busybox-34afe47ef9b50cbd85ac51cc0d26c01b7838d190684ad53adbe6f0ea8a18d839.log"
"kubernetes.var.log.containers.busybox_app_busybox-58e0e8c1d139cebb12f541094ae6d76f244d41588fbbe9d4215e06e806f0bd19.log"
Today
Sergey Yedrikov 12:22 AM
And for groupBy: namespaceUUIDCreate a new project called 'app':
$ oc new-project appMake a note of the UUID of the app project:
$ oc get project/app -ojson | jq .metadata.uid
"b54896bd-5849-4a76-bea3-56b44874d591"Run a Pod in it:
$ oc run busybox --image=busybox – sh -c 'while true; do echo "My life is my message"; sleep 3; done'
$ oc logs -f busybox
My life is my message
...List the log groups, "mycluster-7977k.b54896bd-5849-4a76-bea3-56b44874d591" is the log group for the app project:
$ aws --output json logs describe-log-groups | jq .logGroups[].logGroupName
"mycluster-7977k.audit"
"mycluster-7977k.b54896bd-5849-4a76-bea3-56b44874d591"
"mycluster-7977k.infrastructure"List the log streams in the "mycluster-7977k.b54896bd-5849-4a76-bea3-56b44874d591" log group:
$ aws --output json logs describe-log-streams --log-group-name mycluster-7977k.b54896bd-5849-4a76-bea3-56b44874d591 | jq .logStreams[].logStreamName
"kubernetes.var.log.containers.busybox_app_busybox-c779925764511bc93f849487d264ef6e68395e4e875f10e9e8edf2f79a15ef99.log"Now remove the app project, together with the Pod running in it:
$ oc delete project/appList the log groups, the "mycluster-7977k.b54896bd-5849-4a76-bea3-56b44874d591" log group is still there
[syedriko@localhost cluster-logging-operator]$ aws --output json logs describe-log-groups | jq .logGroups[].logGroupName
"mycluster-7977k.audit"
"mycluster-7977k.b54896bd-5849-4a76-bea3-56b44874d591"
"mycluster-7977k.infrastructure"Recreate the app project, make a note of its UUID and the fact that it's different from the UUID of the previous app project, and deploy a busybox Pod:
$ oc new-project app
$ oc get project/app -ojson | jq .metadata.uid
"d72f425f-de32-434f-8aee-65d6f3f11453"
$ oc run busybox --image=busybox – sh -c 'while true; do echo "My life is my message"; sleep 3; done'
pod/busybox created
$ oc logs -f busybox
My life is my message
...List the log groups, note there's now a new log group for the new app project, mycluster-7977k.d72f425f-de32-434f-8aee-65d6f3f11453:
$ aws --output json logs describe-log-groups | jq .logGroups[].logGroupName
"mycluster-7977k.audit"
"mycluster-7977k.b54896bd-5849-4a76-bea3-56b44874d591"
"mycluster-7977k.d72f425f-de32-434f-8aee-65d6f3f11453"
"mycluster-7977k.infrastructure"List the log streams in the new log group, here it is the log stream for the new busybox Pod:
$ aws --output json logs describe-log-streams --log-group-name mycluster-7977k.d72f425f-de32-434f-8aee-65d6f3f11453 | jq .logStreams[].logStreamName
"kubernetes.var.log.containers.busybox_app_busybox-cec39ffdc5d6e1c6e477f8e5741d9e5a9a227754dac2c5549682f9a69fbac053.log"