{"id":21957082,"url":"https://github.com/trussworks/ecs-service-logs","last_synced_at":"2025-04-23T15:49:09.463Z","repository":{"id":37956015,"uuid":"246624053","full_name":"trussworks/ecs-service-logs","owner":"trussworks","description":"ecs-service-logs is used to filter JSON-formatted log lines in CloudWatch","archived":false,"fork":false,"pushed_at":"2025-04-23T04:27:58.000Z","size":8608,"stargazers_count":1,"open_issues_count":6,"forks_count":2,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-23T05:26:53.100Z","etag":null,"topics":["aws","aws-cloudwatch","logging"],"latest_commit_sha":null,"homepage":"https://github.com/trussworks/ecs-service-logs","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/trussworks.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,"zenodo":null}},"created_at":"2020-03-11T16:32:10.000Z","updated_at":"2025-01-04T00:01:26.000Z","dependencies_parsed_at":"2024-02-19T18:03:15.760Z","dependency_job_id":"00a3c9c4-d497-446e-ae6e-714f58dc0835","html_url":"https://github.com/trussworks/ecs-service-logs","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trussworks%2Fecs-service-logs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trussworks%2Fecs-service-logs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trussworks%2Fecs-service-logs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trussworks%2Fecs-service-logs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trussworks","download_url":"https://codeload.github.com/trussworks/ecs-service-logs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250465156,"owners_count":21435148,"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":["aws","aws-cloudwatch","logging"],"created_at":"2024-11-29T08:49:38.352Z","updated_at":"2025-04-23T15:49:09.442Z","avatar_url":"https://github.com/trussworks.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ecs-service-logs\n\n## Description\n\n**ecs-service-logs** is used to filter JSON-formatted log lines in CloudWatch.\n\n## Installation\n\nFor OSX Homebrew:\n\n```sh\nbrew tap trussworks/tap\nbrew install ecs-service-logs\n```\n\n## Usage\n\nEasily filter JSON formatted application logs from an ECS Service or Task. This tool compiles a chain of filters into a filter pattern in the format used by CloudWatch Logs. You can filter application logs by ECS Cluster (--cluster), ECS Service (--service), and environment (--environment). When filtering logs for a stopped task, use \"--status STOPPED\". Trailing positional arguments are added to the query. Equality (X=Y) and inverse equality (X!=Y) are supported.  Wildcards are also supported, e.g, \"url!=health*\".\n\n[https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).\n\n```shell\nUsage:\n  ecs-service-logs show [flags] [msg=XYZ] [referer=XYZ]...\n\nFlags:\n      --aws-region string                The AWS Region (default \"us-west-2\")\n  -c, --cluster string                   The cluster name\n  -f, --ecs-task-def-family string       The ECS task definition family.\n  -r, --ecs-task-def-revision string     The ECS task definition revision.\n  -e, --environment string               The environment name\n  -b, --git-branch string                The git branch\n      --git-commit string                The git commit\n  -h, --help                             help for show\n  -l, --level string                     The log level: debug, info, warn, error, panic, fatal\n  -n, --limit int                        If 1 or above, the maximum number of log events to print to stdout. (default -1)\n  -p, --page-size int                    The page size or maximum number of log events to return during each API call.  The default is 10,000 log events. (default -1)\n  -s, --service string                   The service name\n      --status string                    The task status: RUNNING, STOPPED, ALL (default \"ALL\")\n  -t, --tasks int                        If 1 or above, the maximum number of log streams (aka tasks) to print to stdout. (default 10)\n  -v, --verbose                          Print section lines\n```\n\n## Examples\n\nSearch for a client IP Address.\n\n```shell\necs-service-logs show -s app -e staging x-forwarded-for=*1.2.3.4\n```\n\nSearch for a client IP Address in only running tasks.\n\n```shell\necs-service-logs show --status RUNNING -c app-staging -s app x-forwarded-for=*1.2.3.4\n```\n\nSearch for requests in a given environment, but not health checks (url is defined but does not start with /health).\n\n```shell\necs-service-logs show -s app -e staging url=* url!=/health*\n```\n\nFilter by url is defined and git commit.\n\n```shell\necs-service-logs show -s app -e experimental url=* git_commit=asdfnh98nwuefr9a8jf\n```\n\nFilter by url is defined and the number of headers is greater than 14.\n\n```shell\necs-service-logs show -s app -e experimental url=* \"headers\u003e14\"\n```\n\nSearch for requests with an event type, status, and specified time range\n\n```shell\necs-service-logs show -s app -e experimental event_type=\"create_office_user\" --status=ALL --start-time=2019-09-16T23:43:00Z --end-time=2019-09-16T23:43:20Z\n```\n\n**Note:** `event_type` will follow the convention of\n`{ACTION}_{SINGULAR_RECORD_TYPE}` where `ACTION` can be one of `create`, `update`, or `delete`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrussworks%2Fecs-service-logs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrussworks%2Fecs-service-logs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrussworks%2Fecs-service-logs/lists"}