- defaultTab: output description: |- This Rundeck Job grabs recent logs from a specified Kubernetes selector (e.g. app=cartservice) and posts to the PagerDuty incident. This job is a template-job provided by PagerDuty. It is designed to be invoked via [Automation-Actions](https://www.rundeck.com/rundeck-actions) Documentation for this workflow can be found in the Learning section of our documentation [here](https://docs.rundeck.com/docs/learning/solutions/auto-incident-kubernetes-logs.html) executionEnabled: true group: Auto-Diagnostics id: 33ef389a-d45c-42d1-af56-3360ff0dade5 loglevel: INFO name: Auto-Diagnostics - Kubernetes Logs nodeFilterEditable: false options: - description: 'Selector for defining pods to retrieve logs from. Example: app=paymentservice' label: Kubernetes Selector name: k8s_selector required: true value: app=cartservice - description: Kubernetes namespace. label: Namespace name: namespace value: default - hidden: true label: PagerDuty Incident ID name: pd_incident_id value: Q1CS9YFE3M4NMY plugins: ExecutionLifecycle: {} scheduleEnabled: true schedules: [] sequence: commands: - description: Grab logs from all containers within Kubernetes selector exec: kubectl -n ${option.namespace} logs -l ${option.k8s_selector} --all-containers=true --since=5m plugins: LogFilter: - config: hideOutput: 'true' logData: 'true' name: pod_log_output regex: (.*) type: key-value-data-multilines - configuration: api_token: keys/pagerduty_api email: rundeck@rundeck.com incident_id: ${option.pd_incident_id} note: Recent Pod Logs:\n ${data.pod_log_output*} description: Post Logs To PagerDuty nodeStep: false type: pd-note-step keepgoing: false strategy: node-first tags: 'auto-diagnostics,kubernetes,pagerduty' uuid: 33ef389a-d45c-42d1-af56-3360ff0dade5