{"id":24377841,"url":"https://github.com/gitkashish/golog","last_synced_at":"2026-05-20T00:32:48.488Z","repository":{"id":272989836,"uuid":"918395161","full_name":"gitKashish/golog","owner":"gitKashish","description":"Simple and efficient log parsing and formatting tool. It allows you to define templates to extract and present log data in a structured and readable way","archived":false,"fork":false,"pushed_at":"2025-03-08T10:05:29.000Z","size":1989,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T10:27:36.618Z","etag":null,"topics":["cli-app","formatter","golang","logging"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitKashish.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,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T20:58:36.000Z","updated_at":"2025-03-08T10:05:32.000Z","dependencies_parsed_at":"2025-02-15T21:34:29.415Z","dependency_job_id":null,"html_url":"https://github.com/gitKashish/golog","commit_stats":null,"previous_names":["gitkashish/golog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitKashish%2Fgolog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitKashish%2Fgolog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitKashish%2Fgolog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitKashish%2Fgolog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitKashish","download_url":"https://codeload.github.com/gitKashish/golog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242995878,"owners_count":20218815,"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":["cli-app","formatter","golang","logging"],"created_at":"2025-01-19T06:17:08.288Z","updated_at":"2025-12-28T04:08:35.794Z","avatar_url":"https://github.com/gitKashish.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# golog\n\n`golog` is a simple and efficient log parsing and formatting tool.  It allows you to define templates to extract and present log data in a structured and readable way.\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/gitKashish/golog)](https://goreportcard.com/report/github.com/gitKashish/golog) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n## 🚀 Getting Started\n\n### Installation\n\n#### Binary Installation (Recommended)\n\n```bash\n# Install the latest version\ngo install github.com/gitKashish/golog@latest\n```\n\nThis will install the `golog` binary to your `$GOPATH/bin` directory (or `$GOBIN` if set). Make sure this directory is in your `PATH`.\n\n#### Building from Source\n\n```bash\n# Clone repository\ngit clone https://github.com/gitKashish/golog.git\n\n# Build binary\ncd golog\ngo build\n```\n\nThis will create a `golog` executable in your current directory.\n\n### Creating `template.yaml`\n\n`golog` relies on a `template.yaml` file to define how logs should be parsed and formatted. Create this file in the same directory as the `golog` binary.\n\n## 📄 Template Format\n\nThe `template.yaml` file defines two key templates: `sourceTemplate` and `targetTemplate`.\n\n### 1. `sourceTemplate`\n\nThe `sourceTemplate` describes the structure of your *incoming* log lines. It uses a specific format for defining fields:\n\n```\n@fieldName-fieldType@\n```\n\n*   **`fieldName`:** The name of the field (must be unique, alphanumeric characters and underscores only).\n*   **`fieldType`:** The data type of the field.\n\nSupported Field Types:\n\n| Type      | Symbol | Description                                                              |\n| --------- | :----: | ------------------------------------------------------------------------ |\n| Raw       | `raw`  | Value is returned as is (no formatting).                               |\n| Number    | `number` | Value is treated as a number.                                           |\n| String    | `string` | Value is treated as a string.                                          |\n| JSON      | `json`  | Value is parsed as a JSON string and pretty-printed.                   |\n| Timestamp | `timestamp` | Value is parsed as a timestamp and formatted into RFC822Z format. |\n| Default   | N/A    | Used internally when the log doesn't match the `sourceTemplate`.        |\n\n### 2. `targetTemplate`\n\nThe `targetTemplate` defines how the *output* should be formatted. It uses the field names defined in the `sourceTemplate`:\n\n```\n@fieldName@\n```\n\nA field name can be used multiple times in the `targetTemplate`.\n\n## ✨ Example\n\n**Log Input:**\n\n```\n5|3022  | --\u003e2025-01-24 07:29:52.954 :----: users :=: updateJobStatus :=: {\"EVENT\":\"deleteNotificationTaskFromScheduler\",\"ERROR\":{\"errno\":-110,\"code\":\"ETIMEDOUT\",\"syscall\":\"connect\",\"address\":\"52.41.75.101\",\"port\":3013}}\n```\n\n**`template.yaml`:**\n\n```yaml\nsourceTemplate: \"@server-number@|@instance-number@  | --\u003e@time-timestamp@ :----: @module-string@ :=: @api-string@ :=: @details-json@\"\ntargetTemplate: |\n  ---------------------------\n  Server: @server@\n  Instance: @instance@\n  Timestamp: @time@\n  API: @api@\n  Module : @module@\n  Details: @details@\n  ---------------------------\n```\n\n## 🔎 Usage\n\n### `golog write`\n\nFormats log and writes to a specified file.\n\n```bash\ngolog write -i \u003cinput_file\u003e -o \u003coutput_file\u003e [-s]\n```\n\n*   `-i, --input string`: Path to the input log file (required).\n*   `-o, --output string`: Path to the output file (required).\n*   `-s, --show`: Also print the output to the console.\n\n### `golog show`\n\nFormats log and prints the output to the console.\n\n```bash\ngolog show -i \u003cinput_file\u003e\n```\n\n*   `-i, --input string`: Path to the input log file (required).\n\n## ⚙️ Development\n\nGo v1.20 or later is recommended.\n\n## 🤝 Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## 📄 License\nThis project is licensed under the GNU Lesser General Public License v3.0. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitkashish%2Fgolog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitkashish%2Fgolog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitkashish%2Fgolog/lists"}