{"id":13522163,"url":"https://github.com/opsgenie/kubernetes-event-exporter","last_synced_at":"2025-03-31T22:30:54.977Z","repository":{"id":36305342,"uuid":"219929887","full_name":"opsgenie/kubernetes-event-exporter","owner":"opsgenie","description":"Export Kubernetes events to multiple destinations with routing and filtering","archived":true,"fork":false,"pushed_at":"2022-08-31T11:33:33.000Z","size":11814,"stargazers_count":1042,"open_issues_count":79,"forks_count":351,"subscribers_count":31,"default_branch":"master","last_synced_at":"2024-11-02T06:31:49.620Z","etag":null,"topics":["alerting","events","exporting","kubernetes","observability"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opsgenie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-06T06:45:00.000Z","updated_at":"2024-10-31T16:37:38.000Z","dependencies_parsed_at":"2022-07-14T04:00:38.128Z","dependency_job_id":null,"html_url":"https://github.com/opsgenie/kubernetes-event-exporter","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsgenie%2Fkubernetes-event-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsgenie%2Fkubernetes-event-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsgenie%2Fkubernetes-event-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsgenie%2Fkubernetes-event-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opsgenie","download_url":"https://codeload.github.com/opsgenie/kubernetes-event-exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246552172,"owners_count":20795771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alerting","events","exporting","kubernetes","observability"],"created_at":"2024-08-01T06:00:43.151Z","updated_at":"2025-03-31T22:30:49.969Z","avatar_url":"https://github.com/opsgenie.png","language":"Go","funding_links":[],"categories":["3. Collect","Cloud platform security","Go"],"sub_categories":["Events \u0026 Problems","Kubernetes"],"readme":"\n# Important Update \n\nThis repository has been deprecated. Please visit https://github.com/resmoio/kubernetes-event-exporter \n\n# kubernetes-event-exporter\n\n\u003e This tool is presented at [KubeCon 2019 San Diego](https://kccncna19.sched.com/event/6aa61eca397e4ff2bdbb2845e5aebb81).\n\nThis tool allows exporting the often missed Kubernetes events to various outputs so that they can be used for\nobservability or alerting purposes. You won't believe what you are missing.\n\n## Deployment\n\nHead on to `deploy/` folder and apply the YAMLs in the given filename order. Do not forget to modify the\n`deploy/01-config.yaml` file to your configuration needs. The additional information for configuration is as follows:\n\n## Configuration\n\nConfiguration is done via a YAML file, when run in Kubernetes, ConfigMap. The tool watches all the events and\nuser has to option to filter out some events, according to their properties. Critical events can be routed to alerting\ntools such as Opsgenie, or all events can be dumped to an Elasticsearch instance. You can use namespaces, labels on the\nrelated object to route some Pod related events to owners via Slack. The final routing is a tree which allows\nflexibility. It generally looks like following:\n\n```yaml\nroute:\n  # Main route\n  routes:\n    # This route allows dumping all events because it has no fields to match and no drop rules.\n    - match:\n        - receiver: dump\n    # This starts another route, drops all the events in *test* namespaces and Normal events\n    # for capturing critical events\n    - drop:\n        - namespace: \"*test*\"\n        - type: \"Normal\"\n      match:\n        - receiver: \"critical-events-queue\"\n    # This a final route for user messages\n    - match:\n        - kind: \"Pod|Deployment|ReplicaSet\"\n          labels:\n            version: \"dev\"\n          receiver: \"slack\"\nreceivers:\n# See below for configuring the receivers\n```\n\n* A `match` rule is exclusive, all conditions must be matched to the event.\n* During processing a route, `drop` rules are executed first to filter out events.\n* The `match` rules in a route are independent of each other. If an event matches a rule, it goes down it's subtree.\n* If all the `match` rules are matched, the event is passed to the `receiver`.\n* A route can have many sub-routes, forming a tree.\n* Routing starts from the root route.\n\n### Opsgenie\n\n[Opsgenie](https://www.opsgenie.com) is an alerting and on-call management tool. kubernetes-event-exporter can push to\nevents to Opsgenie so that you can notify the on-call when something critical happens. Alerting should be precise and\nactionable, so you should carefully design what kind of alerts you would like in Opsgenie. A good starting point might\nbe filtering out Normal type of events, while some additional filtering can help. Below is an example configuration.\n\n```yaml\n# ...\nreceivers:\n  - name: \"alerts\"\n    opsgenie:\n      apiKey: xxx\n      priority: \"P3\"\n      message: \"Event {{ .Reason }} for {{ .InvolvedObject.Namespace }}/{{ .InvolvedObject.Name }} on K8s cluster\"\n      alias: \"{{ .UID }}\"\n      description: \"\u003cpre\u003e{{ toPrettyJson . }}\u003c/pre\u003e\"\n      tags:\n        - \"event\"\n        - \"{{ .Reason }}\"\n        - \"{{ .InvolvedObject.Kind }}\"\n        - \"{{ .InvolvedObject.Name }}\"\n```\n\n### Webhooks/HTTP\n\nWebhooks are the easiest way of integrating this tool to external systems. It allows templating \u0026 custom headers which\nallows you to push events to many possible sources out there. See [Customizing Payload] for more information.\n\n```yaml\n# ...\nreceivers:\n  - name: \"alerts\"\n    webhook:\n      endpoint: \"https://my-super-secret-service.com\"\n      headers:\n        X-API-KEY: \"123\"\n        User-Agent: kube-event-exporter 1.0\n      layout: # Optional\n```\n\n### Elasticsearch\n\n[Elasticsearch](https://www.elastic.co/) is a full-text, distributed search engine which can also do powerful\naggregations. You may decide to push all events to Elasticsearch and do some interesting queries over time to find out\nwhich images are pulled, how often pod schedules happen etc. You\ncan [watch the presentation](https://static.sched.com/hosted_files/kccncna19/d0/Exporting%20K8s%20Events.pdf)\nin Kubecon to see what else you can do with aggregation and reporting.\n\n```yaml\n# ...\nreceivers:\n  - name: \"dump\"\n    elasticsearch:\n      hosts:\n        - http://localhost:9200\n      index: kube-events\n      # Ca be used optionally for time based indices, accepts Go time formatting directives\n      indexFormat: \"kube-events-{2006-01-02}\"\n      username: # optional\n      password: # optional\n      cloudID: # optional\n      apiKey: # optional\n      # If set to true, it allows updating the same document in ES (might be useful handling count)\n      useEventID: true|false\n      # Type should be only used for clusters Version 6 and lower.\n      # type: kube-event\n      # If set to true, all dots in labels and annotation keys are replaced by underscores. Defaults false\n      deDot: true|false\n      layout: # Optional\n      tls: # optional, advanced options for tls\n        insecureSkipVerify: true|false # optional, if set to true, the tls cert won't be verified\n        serverName: # optional, the domain, the certificate was issued for, in case it doesn't match the hostname used for the connection\n        caFile: # optional, path to the CA file of the trusted authority the cert was signed with \n```\n\n### Slack\n\nSlack is a cloud-based instant messaging platform where many people use it for integrations and getting notified by\nsoftware such as Jira, Opsgenie, Google Calendar etc. and even some implement ChatOps on it. This tool also allows\nexporting events to Slack channels or direct messages to persons. If your objects in Kubernetes, such as Pods,\nDeployments have real owners, you can opt-in to notify them via important events by using the labels of the objects. If\na Pod sandbox changes and it's restarted, or it cannot find the Docker image, you can immediately notify the owner.\n\n```yaml\n# ...\nreceivers:\n  - name: \"slack\"\n    slack:\n      token: YOUR-API-TOKEN-HERE\n      channel: \"@{{ .InvolvedObject.Labels.owner }}\"\n      message: \"{{ .Message }}\"\n      color: # optional\n      title: # optional\n      author_name: # optional\n      footer: # optional\n      fields:\n        namespace: \"{{ .Namespace }}\"\n        reason: \"{{ .Reason }}\"\n        object: \"{{ .Namespace }}\"\n\n```\n\n### Kinesis\n\nKinesis is an AWS service allows to collect high throughput messages and allow it to be used in stream processing.\n\n```yaml\n# ...\nreceivers:\n  - name: \"kinesis\"\n    kineis:\n      streamName: \"events-pipeline\"\n      region: us-west-2\n      layout: # Optional\n```\n\n### Firehose\n\nFirehose is an AWS service providing high throughput message collection for use in stream processing.\n\n```yaml\n# ...\nreceivers:\n  - name: \"firehose\"\n    firehose:\n      deliveryStreamName: \"events-pipeline\"\n      region: us-west-2\n      layout: # Optional\n```\n### SNS\n\nSNS is an AWS service for highly durable pub/sub messaging system.\n\n```yaml\n# ...\nreceivers:\n  - name: \"sns\"\n    sns:\n      topicARN: \"arn:aws:sns:us-east-1:1234567890123456:mytopic\"\n      region: \"us-west-2\"\n      layout: # Optional\n```\n\n### SQS\n\nSQS is an AWS service for message queuing that allows high throughput messaging.\n\n```yaml\n# ...\nreceivers:\n  - name: \"sqs\"\n    sqs:\n      queueName: \"/tmp/dump\"\n      region: us-west-2\n      layout: # Optional\n```\n\n### File\n\nFor some debugging purposes, you might want to push the events to files. Or you can already have a logging tool that can\ningest these files and it might be a good idea to just use plain old school files as an integration point.\n\n```yaml\n# ...\nreceivers:\n  - name: \"file\"\n    file:\n      path: \"/tmp/dump\"\n      layout: # Optional\n```\n\n### Stdout\n\nStandard out is also another file in Linux. `logLevel` refers to the application logging severity - available levels\n`trace`, `debug`, `info`, `warn`, `error`, `fatal` and `panic`. When not specified, default level is set to `info`. You\ncan use the following configuration as an example.\n\nBy default, events emit with eventime \u003e 5seconds since catching are not collected.\nYou can set this period with trottlePeriod in seconds. Consider to increase time of seconds to catch more events like \"Backoff\".\n\n```yaml\nlogLevel: error\nlogFormat: json\ntrottlePeriod: 5\nroute:\n  routes:\n    - match:\n        - receiver: \"dump\"\nreceivers:\n  - name: \"dump\"\n    stdout: { }\n```\n\n### Kafka\n\nKafka is a popular tool used for real-time data pipelines. You can combine it with other tools for further analysis.\n\n```yaml\nreceivers:\n  - name: \"kafka\"\n    kafka:\n      clientId: \"kubernetes\"\n      topic: \"kube-event\"\n      brokers:\n        - \"localhost:9092\"\n      compressionCodec: \"snappy\"\n      tls:\n        enable: true\n        certFile: \"kafka-client.crt\"\n        keyFile: \"kafka-client.key\"\n        caFile: \"kafka-ca.crt\"\n      sasl:\n        enable: true\n        username: \"kube-event-producer\"\n        passsord: \"kube-event-producer-password\"\n      layout: #optionnal\n        kind: {{ .InvolvedObject.Kind }}\n        namespace: {{ .InvolvedObject.Namespace }}\n        name: {{ .InvolvedObject.Name }}\n        reason: {{ .Reason }}\n        message: {{ .Message }}\n        type: {{ .Type }}\n        createdAt: {{ .GetTimestampISO8601 }}\n```\n\n### OpsCenter\n\n[OpsCenter](https://docs.aws.amazon.com/systems-manager/latest/userguide/OpsCenter.html) provides a central location\nwhere operations engineers and IT professionals can view, investigate, and resolve operational work items (OpsItems)\nrelated to AWS resources. OpsCenter is designed to reduce mean time to resolution for issues impacting AWS resources.\nThis Systems Manager capability aggregates and standardizes OpsItems across services while providing contextual\ninvestigation data about each OpsItem, related OpsItems, and related resources. OpsCenter also provides Systems Manager\nAutomation documents (runbooks) that you can use to quickly resolve issues. You can specify searchable, custom data for\neach OpsItem. You can also view automatically-generated summary reports about OpsItems by status and source.\n\n```yaml\n# ...\nreceivers:\n  - name: \"alerts\"\n    opscenter:\n    title: \"{{ .Message }}\",\n    category: \"{{ .Reason }}\", # Optional\n    description: \"Event {{ .Reason }} for {{ .InvolvedObject.Namespace }}/{{ .InvolvedObject.Name }} on K8s cluster\",\n    notifications: # Optional: SNS ARN\n      - \"sns1\"\n      - \"sns2\"\n  operationalData: # Optional\n    - Reason: \"\"{ { .Reason } }\"}\"\n  priority: \"6\", # Optional\n  region: \"us-east1\",\n  relatedOpsItems: # Optional: OpsItems ARN\n    - \"ops1\"\n    - \"ops2\"\n    severity: \"6\" # Optional\n    source: \"production\"\n  tags: # Optional\n    - ENV: \"{{ .InvolvedObject.Namespace }}\"\n```\n\n### Customizing Payload\n\nSome receivers allow customizing the payload. This can be useful to integrate it to external systems that require the\ndata be in some format. It is designed to reduce the need for code writing. It allows mapping an event using Go\ntemplates, with [sprig](github.com/Masterminds/sprig) library additions. It supports a recursive map definition, so that\nyou can create virtually any kind of JSON to be pushed to a webhook, a Kinesis stream, SQS queue etc.\n\n```yaml\n# ...\nreceivers:\n  - name: pipe\n    kinesis:\n      region: us-west-2\n      streamName: event-pipeline\n      layout:\n        region: \"us-west-2\"\n        eventType: \"kubernetes-event\"\n        createdAt: \"{{ .GetTimestampMs }}\"\n        details:\n          message: \"{{ .Message }}\"\n          reason: \"{{ .Reason }}\"\n          type: \"{{ .Type }}\"\n          count: \"{{ .Count }}\"\n          kind: \"{{ .InvolvedObject.Kind }}\"\n          name: \"{{ .InvolvedObject.Name }}\"\n          namespace: \"{{ .Namespace }}\"\n          component: \"{{ .Source.Component }}\"\n          host: \"{{ .Source.Host }}\"\n          labels: \"{{ toJson .InvolvedObject.Labels}}\"\n```\n\n### Pubsub\n\nPub/Sub is a fully-managed real-time messaging service that allows you to send and receive messages between independent\napplications.\n\n```yaml\nreceivers:\n  - name: \"pubsub\"\n    pubsub:\n      gcloud_project_id: \"my-project\"\n      topic: \"kube-event\"\n      create_topic: False\n```\n\n### Teams\n\nMicrosoft Teams is your hub for teamwork in Office 365. All your team conversations, files, meetings, and apps live\ntogether in a single shared workspace, and you can take it with you on your favorite mobile device.\n\n```yaml\n# ...\nreceivers:\n  - name: \"ms_teams\"\n    teams:\n      endpoint: \"https://outlook.office.com/webhook/...\"\n      layout: # Optional\n```\n\n### Syslog\n\nSyslog sink support enables to write k8s-events to syslog daemon server over tcp/udp. This can also be consumed by\nrsyslog.\n\n```yaml\n# ...\nreceivers:\n  - name: \"syslog\"\n    syslog:\n      network: \"tcp\"\n      address: \"127.0.0.1:11514\"\n      tag: \"k8s.event\"\n\n```\n\n# BigQuery\n\nGoogle's query thing\n\n```yaml\nreceivers:\n  - name: \"my-big-query\"\n    bigquery:\n      location:\n      project:\n      dataset:\n      table:\n      credentials_path:\n      batch_size:\n      max_retries:\n      interval_seconds:\n      timeout_seconds:\n```\n\n# Pipe\n\npipe output directly into some file descriptor\n\n```yaml\nreceivers:\n  - name: \"my_pipe\"\n    pipe:\n      path: \"/dev/stdout\"\n```\n\n# AWS EventBridge\n\n```yaml\nreceivers:\n - name: \"eventbridge\"\n   eventbridge:\n     detailType: \"deployment\"\n     source: \"cd\"\n     eventBusName: \"default\"\n     region: \"ap-southeast-1\"\n     details:\n       message: \"{{ .Message }}\"\n       namespace: \"{{ .Namespace }}\"\n       reason: \"{{ .Reason }}\"\n       object: \"{{ .Namespace }}\"\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopsgenie%2Fkubernetes-event-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopsgenie%2Fkubernetes-event-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopsgenie%2Fkubernetes-event-exporter/lists"}