{"id":37100992,"url":"https://github.com/vishen/klogs","last_synced_at":"2026-01-14T12:17:11.680Z","repository":{"id":57524759,"uuid":"134150504","full_name":"vishen/klogs","owner":"vishen","description":"Kubernetes structured log searching","archived":false,"fork":false,"pushed_at":"2020-08-15T01:48:00.000Z","size":4279,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-18T23:21:55.302Z","etag":null,"topics":["golang-cli","json","kubernetes","structured-logging","text"],"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/vishen.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":"2018-05-20T12:55:49.000Z","updated_at":"2023-08-23T00:45:06.000Z","dependencies_parsed_at":"2022-08-26T03:31:25.226Z","dependency_job_id":null,"html_url":"https://github.com/vishen/klogs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vishen/klogs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishen%2Fklogs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishen%2Fklogs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishen%2Fklogs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishen%2Fklogs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vishen","download_url":"https://codeload.github.com/vishen/klogs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishen%2Fklogs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["golang-cli","json","kubernetes","structured-logging","text"],"created_at":"2026-01-14T12:17:10.906Z","updated_at":"2026-01-14T12:17:11.664Z","avatar_url":"https://github.com/vishen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Klogs\nYet another kubernetes log tools. `klogs` provides structured log searching for kubernetes container logs; exact and regex (golang stdlib) key value matching.\n\n`klogs` is a (mostly) drop-in replacement for `kubectl logs` except with a few differences;\n\n* Defaults to logging all pods and containers in all namespaces\n* Gives structured log searching like; exact and regex key value matching on `JSON` and `text` structured logs\n* Will log additional information about the pod at the start of each the log line; `namespace`, `pod_name`, `container_name`\n* When in follow mode, it will watch for new pods and automatically stream their logs\n\n`klogs` use your default kubernetes configuration to connect to the cluster, but it can be changed using the standard kubernetes config arguments `--kubeconfig` and `--kubecontext`\n\nCurrently the only supported log format types are:\n\n* JSON\n* text\n\n## Installing\n```\n$ go get -u github.com/vishen/klogs\n$ GOPATH/bin/klogs\n```\n\n## Intalling from source\n```\n$ go build -o klogs .\n$ ./klogs\n```\n\n## klogs command\n```\nRead stuctured logs from Kubernetes and filter out lines based on exact or regex matches. Currently only supports JSON and text logs.\n\nUsage:\n  klogs [-f] (POD) [-c CONTAINER] [flags]\n\nFlags:\n  -c, --containers strings     kubernetes selector (label query) to filter on\n  -f, --follow                 tail the logs\n  -h, --help                   help for klogs\n  -d, --key_delimiter string   the string to split the key on for complex key queries\n  -e, --key_exists strings     print lines that have these keys\n      --kubeconfig string      Path to kubernetes config\n      --kubecontext string     Kubernetes context to use\n  -m, --match strings          key and value to match on. eg: label1=value1\n  -n, --namespace string       the kubernetes namespace to filter on\n  -p, --print_keys strings     keys to print if a match is found\n  -r, --regexp strings         key and value to regex match on. eg: label1=value*\n  -s, --search_type string     the search type to use: 'and' or 'or' (default \"and\")\n  -l, --selector string        kubernetes selector (label query) to filter on. eg: app=api\n  -t, --type string            the log type to use: 'json' or 'text'. If unspecified it will attempt to use all log types\n  -v, --verbose                verbose output\n\n```\n\n## Examples\nNOTE: The following examples work with both 'JSON' and 'text' log formats\n\n```\n# Searching for exact matches\n$ klogs -m correlation-id=123123\nseverity=\"info\" correlation-id=\"123123\" msg=\"starting\" user_id=\"7\"\nseverity=\"info\" correlation-id=\"123123\" msg=\"processing\" user_id=\"7\"\nseverity=\"info\" correlation-id=\"123123\" msg=\"ending\" user_id=\"7\"\n\n# Searching for exact multiple matches\n$ klogs -m correlation-id=123123 -m user_id=7\nseverity=\"info\" correlation-id=\"123123\" msg=\"starting\" user_id=\"7\"\nseverity=\"info\" correlation-id=\"123123\" msg=\"processing\" user_id=\"7\"\nseverity=\"info\" correlation-id=\"123123\" msg=\"ending\" user_id=\"7\"\n\n# Searching for regex matches\n$ klogs -r correlation-id=123\nseverity=\"info\" correlation-id=\"123123\" msg=\"starting\" user_id=\"7\"\nseverity=\"info\" correlation-id=\"123123\" msg=\"processing\" user_id=\"7\"\nseverity=\"info\" correlation-id=\"123123\" msg=\"ending\" user_id=\"7\"\n\n# Printing only certain keys with a match\n$ klogs -m correlation-id=123123 -p msg,user_id\nmsg=\"starting\" user_id=\"7\"\nmsg=\"processing\" user_id=\"7\"\nmsg=\"ending\" user_id=\"7\"\n\n# Printing only certain keys\n$ klogs -m -p msg,user_id\nmsg=\"starting\" user_id=\"7\"\nmsg=\"processing\" user_id=\"7\"\nmsg=\"ending\" user_id=\"7\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishen%2Fklogs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvishen%2Fklogs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishen%2Fklogs/lists"}