Dapr进阶-02-查看Dapr日志

2023-12-09 21:39
文章标签 进阶 日志 查看 02 dapr

本文主要是介绍Dapr进阶-02-查看Dapr日志,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1. 查看控制面日志

1.1. 查看控制面pod

kubectl get pod -n dapr-system
NAME                                    READY   STATUS    RESTARTS   AGE
dapr-dashboard-5b7dd7b657-2zkkh         1/1     Running   0          3h41m
dapr-operator-5654bb56b5-296wz          1/1     Running   0          3h41m
dapr-placement-server-0                 1/1     Running   0          3h41m
dapr-sentry-787dd7d995-kfxc9            1/1     Running   0          3h41m
dapr-sidecar-injector-c9498dbfb-q8lql   1/1     Running   0          3h41m

1.2. 查看dashboard日志

kubectl logs -l app=dapr-dashboard -n dapr-system
Dapr Dashboard running on http://localhost:8080

1.3. 查看operator日志 

kubectl logs -l app=dapr-operator -n dapr-system
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"getting tls certificates","scope":"dapr.operator","time":"2022-02-19T03:40:24.651194191Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"starting watch for certs on filesystem: /var/run/dapr/credentials","scope":"dapr.operator","time":"2022-02-19T03:40:24.65123001Z","type":"log","ver":"1.6.0"}
I0219 03:40:24.649795       1 leaderelection.go:243] attempting to acquire leader lease dapr-system/webhooks.dapr.io...
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"Successfully patched webhook in CRD \"subscriptions.dapr.io\"","scope":"dapr.operator","time":"2022-02-19T03:40:24.665018551Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"certificates detected","scope":"dapr.operator","time":"2022-02-19T03:40:26.542818142Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"tls certificates loaded successfully","scope":"dapr.operator","time":"2022-02-19T03:40:26.542934089Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"starting gRPC server","scope":"dapr.operator.api","time":"2022-02-19T03:40:26.543163223Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"Healthz server is listening on :8080","scope":"dapr.operator","time":"2022-02-19T03:40:26.54321365Z","type":"log","ver":"1.6.0"}
I0219 03:40:40.238847       1 leaderelection.go:253] successfully acquired lease dapr-system/operator.dapr.io
I0219 03:40:40.515280       1 leaderelection.go:253] successfully acquired lease dapr-system/webhooks.dapr.io

1.4. 查看placement日志  

kubectl logs -l app=dapr-placement-server -n dapr-system

{"instance":"dapr-placement-server-0","level":"info","msg":"metrics server started on :9090/","scope":"dapr.metrics","time":"2022-02-19T03:40:25.032029995Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"Raft server is starting on 127.0.0.1:8201...","scope":"dapr.placement.raft","time":"2022-02-19T03:40:25.032202627Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"mTLS enabled, getting tls certificates","scope":"dapr.placement","time":"2022-02-19T03:40:25.032217652Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"starting watch for certs on filesystem: /var/run/dapr/credentials","scope":"dapr.placement","time":"2022-02-19T03:40:25.032241757Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"certificates detected","scope":"dapr.placement","time":"2022-02-19T03:40:26.543695359Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"tls certificates loaded successfully","scope":"dapr.placement","time":"2022-02-19T03:40:26.543776867Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"placement service started on port 50005","scope":"dapr.placement","time":"2022-02-19T03:40:26.543793794Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"cluster leadership acquired","scope":"dapr.placement","time":"2022-02-19T03:40:26.544124116Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"Healthz server is listening on :8080","scope":"dapr.placement","time":"2022-02-19T03:40:26.544172756Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"leader is established.","scope":"dapr.placement","time":"2022-02-19T03:40:26.544193223Z","type":"log","ver":"1.6.0"}

 1.5. 查看sentry日志  

kubectl logs -l app=dapr-sentry -n dapr-system
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"Healthz server is listening on :8080","scope":"dapr.sentry","time":"2022-02-19T03:40:24.754579249Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:26.542959438Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"certificate authority loaded","scope":"dapr.sentry","time":"2022-02-19T03:40:26.543041398Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:27.543136292Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"trust root bundle loaded. issuer cert expiry: 2023-02-19 03:40:24 +0000 UTC","scope":"dapr.sentry","time":"2022-02-19T03:40:27.55143922Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"validator created","scope":"dapr.sentry","time":"2022-02-19T03:40:27.55217503Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"sentry certificate authority is running, protecting ya'll","scope":"dapr.sentry","time":"2022-02-19T03:40:27.552211046Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:28.543219987Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:29.543350066Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:30.543436621Z","type":"log","ver":"1.6.0"}

  1.6. 查看injector日志

kubectl logs -l app=dapr-sidecar-injector -n dapr-system
{"instance":"node-slave","level":"info","msg":"Sidecar injector is listening on :4000, patching Dapr-enabled pods","scope":"dapr.injector","time":"2022-02-19T03:40:23.681036027Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"AdmissionReview for Kind=/v1, Kind=Pod, Namespace=dapr-demo Name= () UID=0a42eb04-1906-400b-8439-28cfeb23d420 patchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller fe3cd86c-80ed-407f-b9a5-83ab709863b9 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}","scope":"dapr.injector","time":"2022-02-19T05:37:05.591106282Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"AdmissionReview for Kind=/v1, Kind=Pod, Namespace=dapr-demo Name= () UID=55c8225b-ea68-42c2-baa5-e4cba3be3937 patchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller fe3cd86c-80ed-407f-b9a5-83ab709863b9 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}","scope":"dapr.injector","time":"2022-02-19T05:37:05.591419373Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"ready to write response ...","scope":"dapr.injector","time":"2022-02-19T05:37:05.604812267Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"ready to write response ...","scope":"dapr.injector","time":"2022-02-19T05:37:05.604844148Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"Sidecar injector succeeded injection for app 'service01'","scope":"dapr.injector","time":"2022-02-19T05:37:05.60532952Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"Sidecar injector succeeded injection for app 'service02'","scope":"dapr.injector","time":"2022-02-19T05:37:05.606280729Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"AdmissionReview for Kind=/v1, Kind=Pod, Namespace=dapr-demo Name= () UID=354a2436-3702-4af3-83c0-73383a16ce4b patchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller fe3cd86c-80ed-407f-b9a5-83ab709863b9 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}","scope":"dapr.injector","time":"2022-02-19T05:37:05.617482582Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"ready to write response ...","scope":"dapr.injector","time":"2022-02-19T05:37:05.6371212Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"Sidecar injector succeeded injection for app 'service01'","scope":"dapr.injector","time":"2022-02-19T05:37:05.637204881Z","type":"log","ver":"1.6.0"}

2. 查看service pod日志

2.1. 查看service pod

kubectl get pods -n dapr-demo
NAME                         READY   STATUS             RESTARTS         AGE
service01-7cc7c54c65-g4jzw   1/2     CrashLoopBackOff   26 (2m22s ago)   111m
service01-7cc7c54c65-gsf8c   1/2     CrashLoopBackOff   26 (85s ago)     111m
service02-6d849d9f97-mk286   1/2     CrashLoopBackOff   26 (2m14s ago)   111m

2.2. 描述pod的整体信息

kubectl describe pod service01-7cc7c54c65-g4jzw -n dapr-demo
Name:         service01-7cc7c54c65-g4jzw
Namespace:    dapr-demo
Priority:     0
Node:         node-slave/192.168.0.204
Start Time:   Sat, 19 Feb 2022 13:37:05 +0800
Labels:       app=service01pod-template-hash=7cc7c54c65
Annotations:  dapr.io/app-id: service01dapr.io/app-port: 80dapr.io/enable-debug: truedapr.io/enabled: truedapr.io/log-as-json: truedapr.io/sidecar-liveness-probe-delay-seconds: 10dapr.io/sidecar-readiness-probe-delay-seconds: 10
Status:       Running
IP:           10.44.0.5
IPs:IP:           10.44.0.5
Controlled By:  ReplicaSet/service01-7cc7c54c65
Containers:service01:Container ID:   docker://e875b665df3b0ce52e07635ac587ae1406ff9e208d197083b5ad921eb3edde46Image:          docker.io/k8schina/service01:v1Image ID:       docker-pullable://k8schina/service01@sha256:8ead4a7aa2eac005badfbac0c615b2be930aada2a17994e7891b720c62da2abbPort:           80/TCPHost Port:      0/TCPState:          RunningStarted:      Sat, 19 Feb 2022 13:37:25 +0800Ready:          TrueRestart Count:  0Environment:DAPR_HTTP_PORT:  3500DAPR_GRPC_PORT:  50001Mounts:/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-s2f8g (ro)daprd:Container ID:  docker://4cf1fac4f809945132bcb28f00b62bd974c1036c32f56b56781fa3cd958f8dd1Image:         docker.io/daprio/daprd:1.6.0Image ID:      docker-pullable://daprio/daprd@sha256:db7ce4723d61566a2e6be24bd7d136e317023cf11ee78b9c6f55c00ec0c6223fPorts:         3500/TCP, 50001/TCP, 50002/TCP, 9090/TCP, 40000/TCPHost Ports:    0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCPCommand:/dlvArgs:--listen=:40000--accept-multiclient--headless=true--log--api-version=2exec/daprd----modekubernetes--dapr-http-port3500--dapr-grpc-port50001--dapr-internal-grpc-port50002--dapr-listen-addresses[::1],127.0.0.1--dapr-public-port3501--app-port80--app-idservice01--control-plane-addressdapr-api.dapr-system.svc.cluster.local:80--app-protocolhttp--placement-host-addressdapr-placement-server.dapr-system.svc.cluster.local:50005--config--log-levelinfo--app-max-concurrency-1--sentry-addressdapr-sentry.dapr-system.svc.cluster.local:80--enable-metrics=true--metrics-port9090--dapr-http-max-request-size-1--dapr-http-read-buffer-size-1--dapr-graceful-shutdown-seconds-1--log-as-json--enable-mtlsState:          WaitingReason:       CrashLoopBackOffLast State:     TerminatedReason:       ContainerCannotRunMessage:      OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/dlv": stat /dlv: no such file or directory: unknownExit Code:    127Started:      Sat, 19 Feb 2022 16:01:45 +0800Finished:     Sat, 19 Feb 2022 16:01:45 +0800Ready:          FalseRestart Count:  33Liveness:       http-get http://:3501/v1.0/healthz delay=10s timeout=3s period=6s #success=1 #failure=3Readiness:      http-get http://:3501/v1.0/healthz delay=10s timeout=3s period=6s #success=1 #failure=3Environment:NAMESPACE:              dapr-demoDAPR_TRUST_ANCHORS:     -----BEGIN CERTIFICATE-----MIIB2zCCAYKgAwIBAgIRAMWpJtBC5uk9Folb7dBap/0wCgYIKoZIzj0EAwIwMTEXMBUGA1UEChMOZGFwci5pby9zZW50cnkxFjAUBgNVBAMTDWNsdXN0ZXIubG9jYWwwHhcNMjIwMjE5MDMyNTI0WhcNMjMwMjE5MDM0MDI0WjAxMRcwFQYDVQQKEw5kYXByLmlvL3NlbnRyeTEWMBQGA1UEAxMNY2x1c3Rlci5sb2NhbDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABFe0HFo8WfhDK3UzH84uh3ra9veCh4YBUH3eLD7XaaDR/gnGK28DDP+P6YMVzhV0/sWe2/Ztr2ggQmWensD09K2jezB5MA4GA1UdDwEB/wQEAwICBDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUCMQ2YWm8hnbar1tunG0+zkyehn0wGAYDVR0RBBEwD4INY2x1c3Rlci5sb2NhbDAKBggqhkjOPQQDAgNHADBEAiB+v/xvuHpKwkyTvdLDjFLEStRPGcqVXqp5WbMlFs2JTwIgVR3ehcuItyV872tFUYFCISbiARGxbJzgPs9OQnvHjPM=-----END CERTIFICATE-----DAPR_CERT_CHAIN:        -----BEGIN CERTIFICATE-----MIIBxjCCAWugAwIBAgIRAIXuoUC5KTyCXjVOdmbhI1UwCgYIKoZIzj0EAwIwMTEXMBUGA1UEChMOZGFwci5pby9zZW50cnkxFjAUBgNVBAMTDWNsdXN0ZXIubG9jYWwwHhcNMjIwMjE5MDMyNTI0WhcNMjMwMjE5MDM0MDI0WjAYMRYwFAYDVQQDEw1jbHVzdGVyLmxvY2FsMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeGahgXjsvOXPIkAWopUtFHvvBUNFWkmDyxdllNVJKvH6X0JYmW7y88VeVIeHIr0qHefaQxSw0xBJgaK0EdQG7qN9MHswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIAvF908laB8Y4eSZCq+3lBWHIJNMB8GA1UdIwQYMBaAFAjENmFpvIZ22q9bbpxtPs5MnoZ9MBgGA1UdEQQRMA+CDWNsdXN0ZXIubG9jYWwwCgYIKoZIzj0EAwIDSQAwRgIhANvDUJA1fE3Vu0NlrDVIua2Zq/ooaDbiFqnYHYSRJ298AiEA8KTqLv2Rf39t2rMQc1UEQEMMGY8GAhX6k0a169kbz8Y=-----END CERTIFICATE-----DAPR_CERT_KEY:          -----BEGIN EC PRIVATE KEY-----MHcCAQEEIIYFyiu9kkn89a5lfBBgmiPIH7UGDet1FxlmLqdKZnhPoAoGCCqGSM49AwEHoUQDQgAEeGahgXjsvOXPIkAWopUtFHvvBUNFWkmDyxdllNVJKvH6X0JYmW7y88VeVIeHIr0qHefaQxSw0xBJgaK0EdQG7g==-----END EC PRIVATE KEY-----SENTRY_LOCAL_IDENTITY:  dapr-demo:defaultMounts:/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-s2f8g (ro)
Conditions:Type              StatusInitialized       TrueReady             FalseContainersReady   FalsePodScheduled      True
Volumes:kube-api-access-s2f8g:Type:                    Projected (a volume that contains injected data from multiple sources)TokenExpirationSeconds:  3607ConfigMapName:           kube-root-ca.crtConfigMapOptional:       <nil>DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300snode.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:Type     Reason   Age                     From     Message----     ------   ----                    ----     -------Warning  BackOff  2m23s (x712 over 147m)  kubelet  Back-off restarting failed container

2.3. 查看pod中所有container的日志

kubectl logs service01-7cc7c54c65-g4jzw --all-containers=true -n dapr-demo
{"EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:80","State":{"Message":"Now listening on: http://[::]:80","address":"http://[::]:80","{OriginalFormat}":"Now listening on: {address}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Application started. Press Ctrl\u002BC to shut down.","State":{"Message":"Application started. Press Ctrl\u002BC to shut down.","{OriginalFormat}":"Application started. Press Ctrl\u002BC to shut down."}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Hosting environment: Production","State":{"Message":"Hosting environment: Production","envName":"Production","{OriginalFormat}":"Hosting environment: {envName}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Content root path: /app/","State":{"Message":"Content root path: /app/","contentRoot":"/app/","{OriginalFormat}":"Content root path: {contentRoot}"}}

2.4. 查看pod中dapr container的日志

kubectl logs service01-7cc7c54c65-g4jzw -c daprd -n dapr-demo

2.5. 查看pod中dapr container最近几行日志

  • --tail=-1 查看所有行日志
kubectl logs --tail=10 service01-7cc7c54c65-g4jzw -c daprd -n dapr-demo

2.6. 持续查看pod中dapr container的日志

kubectl logs -f service01-7cc7c54c65-g4jzw -c daprd -n dapr-demo

2.7. 按label查看日志

kubectl logs --selector=app=service01 --all-containers -n dapr-demo

3. 查看系统日志

3.1. 使用 tail 工具

tail /var/log/messages -f
Feb 19 16:32:58 localhost kubelet[1077]: E0219 16:32:58.466307    1077 pod_workers.go:918] "Error syncing pod, skipping" err="failed to \"StartContainer\" for \"daprd\" with CrashLoopBackOff: \"back-off 5m0s restarting failed container=daprd pod=service01-7cc7c54c65-gsf8c_dapr-demo(efa871c5-0f1d-41e1-b66f-95fff64c9d37)\"" pod="dapr-demo/service01-7cc7c54c65-gsf8c" podUID=efa871c5-0f1d-41e1-b66f-95fff

3.2. 使用 journalctl 工具

3.2.1. 查看最近的所有日志的前10行

journalctl -r -n 10
-- Logs begin at Tue 2021-12-28 23:05:04 CST, end at Sat 2022-02-19 16:41:01 CST. --
Feb 19 16:40:09 node-master systemd[1]: sysstat-collect.service: Succeeded.
Feb 19 16:40:09 node-master systemd[1]: Starting system activity accounting tool...
Feb 19 16:36:04 node-master systemd-logind[802]: Removed session 4.
Feb 19 16:36:04 node-master systemd-logind[802]: Session 4 logged out. Waiting for processes to exit.
Feb 19 16:36:04 node-master systemd[1]: session-4.scope: Succeeded.
Feb 19 16:36:04 node-master sshd[39571]: pam_unix(sshd:session): session closed for user root
Feb 19 16:36:01 node-master systemd-logind[802]: Removed session 1.
Feb 19 16:36:01 node-master systemd[1]: session-1.scope: Succeeded.
Feb 19 16:36:01 node-master systemd-logind[802]: Session 1 logged out. Waiting for processes to exit.
Feb 19 16:36:01 node-master sshd[3605]: pam_unix(sshd:session): session closed for user root

3.2.2. 查看指定应用的日志

journalctl -ru kubelet
journalctl -ru kube-scheduler
journalctl -ru kube-apiserver

3.2.3. 结合使用

journalctl -ru kubelet | grep cni | tail -n 5
 network plugin is not ready: cni config uninitialized"
Feb 17 17:18:56 node-master kubelet[42457]: I0217 17:18:56.564503   42457 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
Feb 17 17:18:56 node-master kubelet[42457]: I0217 17:18:56.564436   42457 docker_service.go:258] "Docker cri networking managed by the network plugin" networkPluginName="cni"
Feb 17 17:18:56 node-master kubelet[42457]: I0217 17:18:56.564377   42457 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
Feb 17 17:18:56 node-master kubelet[42457]: I0217 17:18:56.560754   42457 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"

4. 用docker查看日志

4.1. 查看docker container

docker ps | grep k8schina/service02
690594264b75   k8schina/service02                                  "dotnet Service02.dll"   3 hours ago    Up 3 hours              k8s_service02_service02-6d849d9f97-mk286_dapr-demo_f3274fb9-9ce3-4a58-9872-bfccf4f473b6_0

4.2. 查看指定container日志

docker logs 690594264b75
{"EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:80","State":{"Message":"Now listening on: http://[::]:80","address":"http://[::]:80","{OriginalFormat}":"Now listening on: {address}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Application started. Press Ctrl\u002BC to shut down.","State":{"Message":"Application started. Press Ctrl\u002BC to shut down.","{OriginalFormat}":"Application started. Press Ctrl\u002BC to shut down."}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Hosting environment: Production","State":{"Message":"Hosting environment: Production","envName":"Production","{OriginalFormat}":"Hosting environment: {envName}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Content root path: /app/","State":{"Message":"Content root path: /app/","contentRoot":"/app/","{OriginalFormat}":"Content root path: {contentRoot}"}}
{"EventId":13,"LogLevel":"Error","Category":"Microsoft.AspNetCore.Server.Kestrel","Message":"Connection id \u00220HMFJDGT5UAFQ\u0022, Request id \u00220HMFJDGT5UAFQ:00000002\u0022: An unhandled exception was thrown by the application.","Exception":"Dapr.Client.InvocationException: An exception occurred while invoking method: \u0027api/hello\u0027 on app-id: \u0027service01\u0027  ---\u003E System.Net.Http.HttpRequestException: Connection refused (127.0.0.1:3500)  ---\u003E System.Net.Sockets.SocketException (111): Connection refused    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)    at System.Net.Sockets.Socket.\u003CConnectAsync\u003Eg__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)    at System.Threading.Tasks.TaskCompletionSourceWithCancellation\u00601.WaitWithCancellationAsync(CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)    at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpClient.\u003CSendAsync\u003Eg__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)    at Dapr.Client.DaprClientGrpc.InvokeMethodWithResponseAsync(HttpRequestMessage request, CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at Dapr.Client.DaprClientGrpc.InvokeMethodWithResponseAsync(HttpRequestMessage request, CancellationToken cancellationToken)    at Dapr.Client.DaprClientGrpc.InvokeMethodAsync[TResponse](HttpRequestMessage request, CancellationToken cancellationToken)    at Service02.Controllers.HelloController.Hello() in /src/Service02/Controller/HelloController.cs:line 20    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeActionMethodAsync\u003Eg__Awaited|12_0(ControllerActionInvoker invoker, ValueTask\u00601 actionResultValueTask)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeNextActionFilterAsync\u003Eg__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State\u0026 next, Scope\u0026 scope, Object\u0026 state, Boolean\u0026 isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeInnerFilterAsync\u003Eg__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeFilterPipelineAsync\u003Eg__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeAsync\u003Eg__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeAsync\u003Eg__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)    at Microsoft.AspNetCore.Routing.EndpointMiddleware.\u003CInvoke\u003Eg__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)    at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication\u00601 application)","State":{"Message":"Connection id \u00220HMFJDGT5UAFQ\u0022, Request id \u00220HMFJDGT5UAFQ:00000002\u0022: An unhandled exception was thrown by the application.","ConnectionId":"0HMFJDGT5UAFQ","TraceIdentifier":"0HMFJDGT5UAFQ:00000002","{OriginalFormat}":"Connection id \u0022{ConnectionId}\u0022, Request id \u0022{TraceIdentifier}\u0022: An unhandled exception was thrown by the application."}}
{"EventId":13,"LogLevel":"Error","Category":"Microsoft.AspNetCore.Server.Kestrel","Message":"Connection id \u00220HMFJDGT5UAFR\u0022, Request id \u00220HMFJDGT5UAFR:00000002\u0022: An unhandled exception was thrown by the application.","Exception":"Dapr.Client.InvocationException: An exception occurred while invoking method: \u0027api/hello\u0027 on app-id: \u0027service01\u0027  ---\u003E System.Net.Http.HttpRequestException: Connection refused (127.0.0.1:3500)  ---\u003E System.Net.Sockets.SocketException (111): Connection refused    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)    at System.Net.Sockets.Socket.\u003CConnectAsync\u003Eg__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)    at System.Threading.Tasks.TaskCompletionSourceWithCancellation\u00601.WaitWithCancellationAsync(CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)    at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpClient.\u003CSendAsync\u003Eg__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)    at Dapr.Client.DaprClientGrpc.InvokeMethodWithResponseAsync(HttpRequestMessage request, CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at Dapr.Client.DaprClientGrpc.InvokeMethodWithResponseAsync(HttpRequestMessage request, CancellationToken cancellationToken)    at Dapr.Client.DaprClientGrpc.InvokeMethodAsync[TResponse](HttpRequestMessage request, CancellationToken cancellationToken)    at Service02.Controllers.HelloController.Hello() in /src/Service02/Controller/HelloController.cs:line 20    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeActionMethodAsync\u003Eg__Awaited|12_0(ControllerActionInvoker invoker, ValueTask\u00601 actionResultValueTask)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeNextActionFilterAsync\u003Eg__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State\u0026 next, Scope\u0026 scope, Object\u0026 state, Boolean\u0026 isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeInnerFilterAsync\u003Eg__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeFilterPipelineAsync\u003Eg__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeAsync\u003Eg__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeAsync\u003Eg__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)    at Microsoft.AspNetCore.Routing.EndpointMiddleware.\u003CInvoke\u003Eg__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)    at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication\u00601 application)","State":{"Message":"Connection id \u00220HMFJDGT5UAFR\u0022, Request id \u00220HMFJDGT5UAFR:00000002\u0022: An unhandled exception was thrown by the application.","ConnectionId":"0HMFJDGT5UAFR","TraceIdentifier":"0HMFJDGT5UAFR:00000002","{OriginalFormat}":"Connection id \u0022{ConnectionId}\u0022, Request id \u0022{TraceIdentifier}\u0022: An unhandled exception was thrown by the application."}}

这篇关于Dapr进阶-02-查看Dapr日志的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/475154

相关文章

Spring Security 从入门到进阶系列教程

Spring Security 入门系列 《保护 Web 应用的安全》 《Spring-Security-入门(一):登录与退出》 《Spring-Security-入门(二):基于数据库验证》 《Spring-Security-入门(三):密码加密》 《Spring-Security-入门(四):自定义-Filter》 《Spring-Security-入门(五):在 Sprin

Java进阶13讲__第12讲_1/2

多线程、线程池 1.  线程概念 1.1  什么是线程 1.2  线程的好处 2.   创建线程的三种方式 注意事项 2.1  继承Thread类 2.1.1 认识  2.1.2  编码实现  package cn.hdc.oop10.Thread;import org.slf4j.Logger;import org.slf4j.LoggerFactory

[MySQL表的增删改查-进阶]

🌈个人主页:努力学编程’ ⛅个人推荐: c语言从初阶到进阶 JavaEE详解 数据结构 ⚡学好数据结构,刷题刻不容缓:点击一起刷题 🌙心灵鸡汤:总有人要赢,为什么不能是我呢 💻💻💻数据库约束 🔭🔭🔭约束类型 not null: 指示某列不能存储 NULL 值unique: 保证某列的每行必须有唯一的值default: 规定没有给列赋值时的默认值.primary key:

【Linux 从基础到进阶】Ansible自动化运维工具使用

Ansible自动化运维工具使用 Ansible 是一款开源的自动化运维工具,采用无代理架构(agentless),基于 SSH 连接进行管理,具有简单易用、灵活强大、可扩展性高等特点。它广泛用于服务器管理、应用部署、配置管理等任务。本文将介绍 Ansible 的安装、基本使用方法及一些实际运维场景中的应用,旨在帮助运维人员快速上手并熟练运用 Ansible。 1. Ansible的核心概念

Flutter 进阶:绘制加载动画

绘制加载动画:由小圆组成的大圆 1. 定义 LoadingScreen 类2. 实现 _LoadingScreenState 类3. 定义 LoadingPainter 类4. 总结 实现加载动画 我们需要定义两个类:LoadingScreen 和 LoadingPainter。LoadingScreen 负责控制动画的状态,而 LoadingPainter 则负责绘制动画。

flume系列之:查看flume系统日志、查看统计flume日志类型、查看flume日志

遍历指定目录下多个文件查找指定内容 服务器系统日志会记录flume相关日志 cat /var/log/messages |grep -i oom 查找系统日志中关于flume的指定日志 import osdef search_string_in_files(directory, search_string):count = 0

我在移动打工的日志

客户:给我搞一下录音 我:不会。不在服务范围。 客户:是不想吧 我:笑嘻嘻(气笑) 客户:小姑娘明明会,却欺负老人 我:笑嘻嘻 客户:那我交话费 我:手机号 客户:给我搞录音 我:不会。不懂。没搞过。 客户:那我交话费 我:手机号。这是电信的啊!!我这是中国移动!! 客户:我不管,我要充话费,充话费是你们的 我:可是这是移动!!中国移动!! 客户:我这是手机号 我:那又如何,这是移动!你是电信!!

从0到1,AI我来了- (7)AI应用-ComfyUI-II(进阶)

上篇comfyUI 入门 ,了解了TA是个啥,这篇,我们通过ComfyUI 及其相关Lora 模型,生成一些更惊艳的图片。这篇主要了解这些内容:         1、哪里获取模型?         2、实践如何画一个美女?         3、附录:               1)相关SD(稳定扩散模型的组成部分)               2)模型放置目录(重要)

java学习,进阶,提升

http://how2j.cn/k/hutool/hutool-brief/1930.html?p=73689

查看提交历史 —— Git 学习笔记 11

查看提交历史 查看提交历史 不带任何选项的git log-p选项--stat 选项--pretty=oneline选项--pretty=format选项git log常用选项列表参考资料 在提交了若干更新,又或者克隆了某个项目之后,你也许想回顾下提交历史。 完成这个任务最简单而又有效的 工具是 git log 命令。 接下来的例子会用一个用于演示的 simplegit