-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
awslogs driver support for variables using template markup in awslogs-stream #17747
Comments
@samuelkarp I also want this feature, so I started to look at how it could be implemented. The other loggers use the function Here is the relevant portion of the awslogs driver: This shows how the And here is the source for Here are the docs for What do you think a good way to handle this situation would be? Here are some ideas:
What do you think? |
@ianneub, thanks for pinging me. Of your ideas, I'd lean toward number 3. Tags have a different meaning for many AWS resources, so I'd prefer to avoid introducing the potential for confusion. |
+1 I'd also add the ability to use log tags in awslogs-group as well as awslogs-stream. Are there any known workarounds for this limitation? Given awslog-streams should be unique per running container, I don't see any way to effectively override awslogs-stream. ECS task definitions don't really have enough context to specify log groups / streams effectively (e.g. you likely want different log groups for different environments or stacks) |
This one has been quiet for a while. I see a version/1.9 label applied, though I don't see any comments in that or any subsequent releases about this functionality. The documentation doesn't seem to indicate any different behavior for the awslogs driver and my test using the log-opt tag on version 1.10.1 is not supported with the awslogs driver. Does anyone know what the status is or future plans? |
@CameronGo This would most likely have to be coded up by someone who wants this feature. |
@CameronGo the "1.9" label is automatically applied, based on the version an issue was reported with (in the top description) |
+1 for this feature |
1 similar comment
+1 for this feature |
@CameronGo @jhovell (any anyone else using ECS) We just added the ability to specify a stream prefix in the ECS task definition as |
- fixes moby#17747 - Uses the logging.Context for template context - Add tests, check for conflicting options, gofmt - Add documentation - golint ++ vs += - testing pedantry: 'text/template.ExecError composite literal uses unkeyed fields' in tests per @samuelkarp - Moved location - fixed up log message * ahem. and fix the test - refactor style (explict returns) to match rest of file per @nrdlngr - Documentation clarity improvements - Fix logging link - Remove spurious note Signed-off-by: James Nurmi <[email protected]>
@samuelkarp @CameronGo #27707 was merged, does that satisfy this feature request? |
@thaJeztah Yes, I believe so. |
Thanks @samuelkarp, I'll go ahead and close this issue, but @CameronGo let me know if there's still something that needs to be addressed 👍 |
Thanks @thaJeztah - yes that is working and fits my needs. Thanks for checking! |
Good to hear @CameronGo! |
Sorry, but this is not really fixed. Im using the prefix, and its alot better. thx!. But i still got about 12 log streams, because they a grouped by the service ID. DOMAIN/stage-DOMAIN/273ac3de-0bca-4bee-a35b-9e0206009380 In an debugging situation, i need to click on all stream to find the error.. |
could you share the I did the same as
Here is the log stream name I saw, it doesn't show container id of
I did try these
UpdatesI fixed to replace
|
This is a feature request to allow the use of specific variables or the template markup syntax when specifying the awslogs-stream option. The current implementation allows you to use a static value for awslogs-stream or else by default it uses the long container ID. The container ID alone can be difficult to trace and associate with a specific host, so I would like to be able to specify get both the docker hosts hostname along with the short container ID using something like the following:
docker run --log-driver=awslogs --log-opt awslogs-region=us-east-1
--log-opt awslogs-group="hello-world"
--log-opt awslogs-stream="$HOSTNAME-{{.ID}}"
hello-world
docker version:
Client:
Version: 1.9.0
API version: 1.21
Go version: go1.4.2
Git commit: 76d6bc9
Built: Tue Nov 3 17:43:42 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.0
API version: 1.21
Go version: go1.4.2
Git commit: 76d6bc9
Built: Tue Nov 3 17:43:42 UTC 2015
OS/Arch: linux/amd64
docker info:
Containers: 8
Images: 2
Server Version: 1.9.0
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 18
Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-43-generic
Operating System: Ubuntu 14.04.2 LTS
CPUs: 1
Total Memory: 992.5 MiB
Name: chlorine
ID: DG52:Y3T4:2BGU:HRHN:TVQK:IFII:X26U:V733:VHX3:YU7Z:ZSRC:4UQI
uname -a:
Linux chlorine 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Environment:
AWS EC2 Container Services running on custom Ubuntu AMI with ecs-agent container.
The text was updated successfully, but these errors were encountered: