{"id":20017551,"url":"https://github.com/foomo/logfrog","last_synced_at":"2025-06-24T21:36:22.080Z","repository":{"id":64302112,"uuid":"217033054","full_name":"foomo/logfrog","owner":"foomo","description":"CLI program, that likes json logs and it helps you to like them too","archived":false,"fork":false,"pushed_at":"2024-11-24T11:12:50.000Z","size":45,"stargazers_count":4,"open_issues_count":2,"forks_count":3,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-04T22:37:37.958Z","etag":null,"topics":["foomo","foomo-logfrog","log","logging","structured-logging"],"latest_commit_sha":null,"homepage":"https://www.foomo.org","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foomo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-10-23T10:42:42.000Z","updated_at":"2024-07-07T14:57:56.000Z","dependencies_parsed_at":"2025-05-04T22:32:07.743Z","dependency_job_id":"8debd59b-65c2-4aa7-bd41-d8154d4071c8","html_url":"https://github.com/foomo/logfrog","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/foomo/logfrog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foomo%2Flogfrog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foomo%2Flogfrog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foomo%2Flogfrog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foomo%2Flogfrog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foomo","download_url":"https://codeload.github.com/foomo/logfrog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foomo%2Flogfrog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261759916,"owners_count":23205636,"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":["foomo","foomo-logfrog","log","logging","structured-logging"],"created_at":"2024-11-13T08:16:16.261Z","updated_at":"2025-06-24T21:36:21.821Z","avatar_url":"https://github.com/foomo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `logfrog`\n\n\u003e `logfrog` likes json logs, and it helps you to like them too\n\n`logfrog` is a cli program that processes json logs line by line from stdin. Those logs typically come from loggers like [logrus](https://github.com/Sirupsen/logrus), [zap](https://github.com/uber-go/zap), [apex](https://github.com/apex/log) or [others](https://github.com/topics/structured-logging), that let you write logs as json objects.\n\n**Status**: logfrog is very young atm and especially the way we filter is most likely going to change. Despite that it already provides a lot of value, when you are trying to make sense of logs.\n\n## Installation\n\nInstall the latest release of the cli:\n\n````bash\n$ brew update\n$ brew install foomo/tap/logfrog\n````\n\n## Use cases\n\n### stern\n\n```bash\nstern -o json -n some-name-space | logfrog -log-type stern\n```\n\n### docker-compose logs\n\n```bash\ndocker-compose logs --no-color -f | logfrog -log-type docker-compose\n```\n\n### docker\n\n```bash\ndocker logs some-container 2\u003e\u00261 | logfrog\n```\n\n### json log files\n\n```bash\ntail -f path-to-file.json | logfrog\n```\n\n## js filtering\n\n`logfrog` lets you transform and filter json logs with a javascript function named `filter` that must be defined in a .js file that is passed with the ar `--js-filter`\n\n```bash\ntail -f path-to-file.json | logfrog --js-filter path/to/filter.js\n```\n\n- the js file is executed with the otto vm [https://github.com/robertkrimen/otto](https://github.com/robertkrimen/otto)\n- it has to contain a filter function like the one below\n- the file will be reevaluated, when it changes\n- *this is highly EXPERIMENTAL* and we would love to hear back from you\n\n```javascript\n\n// filter function must be named filter, it will be reloaded if updated\n//\n// @param logEntry:{msg?:string;level?:string;time?:string, ...}\n// @param service:string only set with -log-type docker-compose or stern\n//\n// @return logEntry | null when null is returned this entry is filtered out\nfunction filter(logEntry, service) {\n  // let us look at the service in this naive docker-compose example I butcher the name\n  switch (service.substr(0, service.length - 2)) {\n    case \"elasticsearch\":\n      // very minimal log entries for elastic search\n      return { level: logEntry.level, msg: logEntry.message };\n  }\n  // log entry manipulation\n  // some date formatting\n  logEntry.msg = logEntry.msg.substr(0, 256);\n  logEntry.time = new Date(logEntry.time).toLocaleString();\n  // trimming a stack\n  if (logEntry.stack) {\n    logEntry.stack = logEntry.stack.substr(0, 300) + \" ...\";\n  }\n  // go crazy and have fun ;)\n  return logEntry;\n}\n\n\n```\n\n## Standard fields\n\nThis is an initial set of fields, please let us know what we should add.\n\n- `msg` \u003c- msg, message, Message\n- `level` \u003c- level, Level\n- `time` \u003c- time, timestamp, Timestamp\n  \n\n## Todos\n\n- [ ]  map more fields\n- [ ] maybe add a web frontend ?!\n- [x] stern mode like docker-compose\n- [x] add hombrew support\n\n## How to Contribute\n\nMake a pull request...\n\n## License\n\nDistributed under MIT License, please see license file within the code for more details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoomo%2Flogfrog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoomo%2Flogfrog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoomo%2Flogfrog/lists"}