{"id":21810199,"url":"https://github.com/pennix/logback-cloudwatch-appender","last_synced_at":"2026-04-28T12:31:19.488Z","repository":{"id":57737578,"uuid":"379587632","full_name":"Pennix/logback-cloudwatch-appender","owner":"Pennix","description":"Logback appender for aws cloudwatch logs using java 11 java.net.http","archived":false,"fork":false,"pushed_at":"2021-07-04T11:16:58.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T05:24:44.223Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/Pennix.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":"2021-06-23T11:59:14.000Z","updated_at":"2021-07-04T11:17:01.000Z","dependencies_parsed_at":"2022-08-24T14:59:42.248Z","dependency_job_id":null,"html_url":"https://github.com/Pennix/logback-cloudwatch-appender","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pennix%2Flogback-cloudwatch-appender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pennix%2Flogback-cloudwatch-appender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pennix%2Flogback-cloudwatch-appender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pennix%2Flogback-cloudwatch-appender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pennix","download_url":"https://codeload.github.com/Pennix/logback-cloudwatch-appender/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244767542,"owners_count":20507110,"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-27T13:33:30.660Z","updated_at":"2025-10-16T04:43:44.373Z","avatar_url":"https://github.com/Pennix.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Logback appender for AWS CloudWatch logs\n=========================================\n\n# Background\n\nThis package provides a logback appender that writes log events to Cloudwatch logs.\nThere're many projects out there but I created this because I don't want to include aws sdk and that lots of dependencies just for logging.\n\n* That said, the only dependency of this project is **JSR 374** json processing\n* but it is using **java.net.http** to do http request, so you need at least java 11.\n\n# Maven Configuration\n\n``` xml\n\u003cdependencies\u003e\n\t\u003cdependency\u003e\n\t\t\u003cgroupId\u003enet.pennix\u003c/groupId\u003e\n\t\t\u003cartifactId\u003elogback-cloudwatch-appender\u003c/artifactId\u003e\n\t\t\u003c!-- NOTE: change this to the most recent release version from the repo --\u003e\n\t\t\u003cversion\u003e1.0.3\u003c/version\u003e\n\t\t\u003cscope\u003eruntime\u003c/scope\u003e\n\t\u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## Dependencies\n\nThe only dependency besides logback is **JSR 374** json processing, you don't have to include this manually.\n\n``` xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003eorg.glassfish\u003c/groupId\u003e\n\t\u003cartifactId\u003ejavax.json\u003c/artifactId\u003e\n\t\u003cversion\u003e${javax.jsonp.version}\u003c/version\u003e\n\t\u003cscope\u003eruntime\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n# logback.xml Configuration\n\nMinimal logback appender configuration:\n\n**NOTE: DO NOT use the same log stream in multiple appenders or multiple application instances, this is a limit by aws**\n\n``` xml\n\u003cappender name=\"CLOUDWATCH\" class=\"net.pennix.logback.appender.CloudWatchLogsAppender\"\u003e\n\n\t\u003c!-- queue size to hold events before put to cloudwatch --\u003e\n\t\u003cqueueSize\u003e1024\u003c/queueSize\u003e\n\n\t\u003c!-- time to wait for remaining events to be cleared/sent before application quit --\u003e\n\t\u003cmaxFlushTime\u003e1000\u003c/maxFlushTime\u003e\n\n\t\u003c!-- set to true if you need THREAD NAME or MDC PROPERTIES in log message, would slightly decrease performance to do this --\u003e\n\t\u003cprepareForDeferredProcessing\u003efalse\u003c/prepareForDeferredProcessing\u003e\n\n\t\u003cworker\u003e\n\t\t\u003caccessKeyId\u003e${your.aws.access.key.id}\u003c/accessKeyId\u003e\n\t\t\u003csecretAccessKey\u003e${your.aws.secret.access.key}\u003c/secretAccessKey\u003e\n\t\t\u003cregion\u003e${target.region.of.cloudwatch.service}\u003c/region\u003e\n\t\t\u003clogGroup\u003e${your.log.group.name}\u003c/logGroup\u003e\n\t\t\u003clogStream\u003e${your.log.stream.name}\u003c/logStream\u003e\n\n\t\t\u003c!-- logs are put in batch (10000 events max according to aws specification),\n\t\tso we can sleep a little while before draining the queue and doing api request,\n\t\tlower value would raise request frequency and cpu usage,\n\t\tset to 0 to disable sleep,\n\t\twhich is not recommended unless the logs are really that much --\u003e\n\t\t\u003csleepTimeBetweenPuts\u003e500\u003c/sleepTimeBetweenPuts\u003e\n\n\t\t\u003c!-- HTTP request timeout --\u003e\n\t\t\u003chttpTimeout\u003e3000\u003c/httpTimeout\u003e\n\n\t\t\u003clayout\u003e\n\t\t\t\u003cpattern\u003e%1.-1level [%thread] %logger - %msg%n\u003c/pattern\u003e\n\t\t\u003c/layout\u003e\n\t\u003c/worker\u003e\n\u003c/appender\u003e\n```\n\nSee the example [logback-test.xml file](src/main/resources/logback-test.xml).\n\n# IAM Permissions\n\n``` json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"logs:CreateLogGroup\",\n                \"logs:CreateLogStream\",\n                \"logs:DescribeLogStreams\",\n                \"logs:PutLogEvents\"\n            ],\n            \"Resource\": [\n                \"*\"\n            ]\n        }\n    ]\n}\n```\n\nYou should probably limit **Resource** to specific region/account/logGroup.\n\n# ChangeLog Release Notes\n\n## v1.0.3\n\n* auto correct *nextToken* on *InvalidSequenceTokenException*\n\n## v1.0.2\n\n* add config **httpTimeout**\n* catch **Throwable** to prevent worker thread exiting unexpectedly\n\n## v1.0.1\n\n* allow to enable/disable **prepareForDeferredProcessing**\n* sleep between puts to reduce cpu usage\n* removed some *addInfo* to improve performance\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpennix%2Flogback-cloudwatch-appender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpennix%2Flogback-cloudwatch-appender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpennix%2Flogback-cloudwatch-appender/lists"}