{"id":18293078,"url":"https://github.com/kubesphere/logsidecar-injector","last_synced_at":"2025-04-05T11:30:47.056Z","repository":{"id":39636030,"uuid":"203292018","full_name":"kubesphere/logsidecar-injector","owner":"kubesphere","description":"A MutatingAdmissionWebhook that adds a sidecar to your pod. This sidecar is just for forwarding file log on the volume.","archived":false,"fork":false,"pushed_at":"2024-01-29T12:33:21.000Z","size":105,"stargazers_count":25,"open_issues_count":3,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-13T21:43:10.614Z","etag":null,"topics":[],"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/kubesphere.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-08-20T03:22:49.000Z","updated_at":"2024-03-19T16:09:02.000Z","dependencies_parsed_at":"2023-12-28T06:44:35.867Z","dependency_job_id":"0b088c32-1638-4065-80e8-6647203578c3","html_url":"https://github.com/kubesphere/logsidecar-injector","commit_stats":{"total_commits":15,"total_committers":6,"mean_commits":2.5,"dds":0.6,"last_synced_commit":"39352d608a7983d9625863b3e34a3da166812d3d"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Flogsidecar-injector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Flogsidecar-injector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Flogsidecar-injector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Flogsidecar-injector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kubesphere","download_url":"https://codeload.github.com/kubesphere/logsidecar-injector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247330413,"owners_count":20921625,"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":[],"created_at":"2024-11-05T14:21:47.651Z","updated_at":"2025-04-05T11:30:46.821Z","avatar_url":"https://github.com/kubesphere.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logsidecar-injector\n\nLogsidecar-injector is a Kubernetes mutating webhook server that adds a sidecar to your pod. This sidecar is just to forward logs from files on volumes to stdout.\n\n# Install\n\nTo quickly install the logsidecar injector inside a cluster, just run the following command:\n\n```bash\nkubectl apply -f https://raw.githubusercontent.com/kubesphere/logsidecar-injector/master/config/bundle.yaml\n```\n\u003e Note: it is default to install into the namespace `kubesphere-logging-system`\n\n# Usage\nSuppose you want to inject the log sidecar into your workloads in the namespace `default`:\n\n- Firstly add a label to the namespace:\n  ```bash\n  kubectl label ns default logging.kubesphere.io/logsidecar-injection=enabled\n  ```\n\n- Then add an annotation to pod template of your workload:\n  ```yaml\n  spec:\n    template:\n      metadata:\n        annotations:\n          logging.kubesphere.io/logsidecar-config: 'VALUE'\n  ```\n    \u003e Note: the `VALUE` is a json string which has format as follows:\n    \u003e ```json\n    \u003e {\n    \u003e     \"containerLogConfigs\": {\n    \u003e         \"$containername\": {\n    \u003e             \"$volumename\": [\n    \u003e                 \"$relativepath\"\n    \u003e             ]\n    \u003e         }\n    \u003e     }\n    \u003e }\n    \u003e ```\n    \u003e `relativepath` is relative path to mountpath within container `containername` at which volume `volumename` was mounted.\n\n- Optionally customize your configuration of filebeat in sidecar container:  \nAdd `logging.kubesphere.io/logsidecar-filebeat-config-jsonpatch` annotation to pod template of your workload. The value of this annotation is a [jsonpatch](http://jsonpatch.com/) string. Logsidecar-injector will generate a new configuration based on default filebeat configuration and this patch, then apply it to the injected sidecar container for your specified workload pod. Here is an example:\n  ```yaml\n  spec:\n    template:\n      metadata:\n        annotations:\n          logging.kubesphere.io/logsidecar-filebeat-config-jsonpatch: '[{\"op\":\"replace\",\"path\":\"/filebeat.inputs/0/tail_file\",\"value\":true}]'\n  ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubesphere%2Flogsidecar-injector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubesphere%2Flogsidecar-injector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubesphere%2Flogsidecar-injector/lists"}