Code Monkey home page Code Monkey logo

Comments (12)

lorengordon avatar lorengordon commented on July 19, 2024

What inputs did you use, and what were you expecting should happen? Is there some indication in the AWS docs that the expected usage is supported by the CloudWatch Agent or CloudWatch Logs?

Here is the documented API restriction on the log stream name...

from terraform-aws-watchmaker.

lorengordon avatar lorengordon commented on July 19, 2024

Ok, I think I found the relevant docs:

file_path – Specifies the path of the log file to upload to CloudWatch Logs. Standard Unix glob matching rules are accepted, with the addition of ** as a super asterisk. For example, specifying /var/log/**.log causes all .log files in the /var/log directory tree to be collected. For more examples, see Glob Library.

Give this branch a try: https://github.com/lorengordon/terraform-aws-watchmaker/tree/cwl-wildcard/modules

from terraform-aws-watchmaker.

moskey71 avatar moskey71 commented on July 19, 2024

Just tested it. This approach allows the logs to be uploaded to CWL, but changing the asterisk to the percent symbol prevents the log stream from being viewed in the console. The log stream name can be clicked on, but it never loads.

As a workaround, selecting "Search Log Group" from within the Log Group will bring up all streams, which allows for the viewing of the log.

from terraform-aws-watchmaker.

lorengordon avatar lorengordon commented on July 19, 2024

Ok that's easy, just need to use a character that is url-safe.

from terraform-aws-watchmaker.

lorengordon avatar lorengordon commented on July 19, 2024

There may be other characters in the path that are not url-safe, so I just switched to encoding the path with urllib.parse.quote(path). Give the branch another try please...

from terraform-aws-watchmaker.

moskey71 avatar moskey71 commented on July 19, 2024

Closer, but no cigar. The log stream is created, but still can't be viewed. The attached image shows the error encountered when trying to view the log.

Screen Shot 2019-07-08 at 2 18 14 PM

from terraform-aws-watchmaker.

lorengordon avatar lorengordon commented on July 19, 2024

Alright, we can hack around it then, but fundamentally there is a bug in the console since these are valid characters in the log stream name that the console just can't handle properly. Can you open a support case?

from terraform-aws-watchmaker.

moskey71 avatar moskey71 commented on July 19, 2024

Will do

Edit: Case opened

from terraform-aws-watchmaker.

moskey71 avatar moskey71 commented on July 19, 2024

I tried replacing the '*' with '.' and that works fine, though it's a little ugly in the console

**.log becomes ...log

moskey71@3cc7bdb#diff-89543a5acaa9dcdd3a588914c7d159c6R727

from terraform-aws-watchmaker.

lorengordon avatar lorengordon commented on July 19, 2024

Yeah, that kind of sucks. Maybe try a few characters that are less common in a directory/file path, and that are not generally special url characters, !~|?

from terraform-aws-watchmaker.

moskey71 avatar moskey71 commented on July 19, 2024

Pipe is unsafe and Question Mark is reserved.
https://perishablepress.com/stop-using-unsafe-characters-in-urls/

I can update the code to use the Exclamation and open a PR, if you agree

from terraform-aws-watchmaker.

lorengordon avatar lorengordon commented on July 19, 2024

Any of the "safe" special characters that actually work in the console and are not so commonly used in a path would be fine. I'd also avoid + since browsers often interpret that as a space... !'(),

from terraform-aws-watchmaker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.