You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Linux, Using "{machine_name}/{logger_name}/{process_id}/{thread_name}/{strftime}" results in the following error:
WatchtowerWarning: Failed to deliver logs: An error occurred (InvalidParameterException) when calling the PutLogEvents operation: 1 validation error detected:
Value 'myhostname.local/path.to.module/12345/MainThread/2024-12-17 22:32:57.097146' at 'logStreamName' failed to satisfy constraint: Member must satisfy regular expression pattern: [^:*]*
Confirming Solution 2-2
Using "{machine_name}/{logger_name}/{process_id}/{thread_name}/{strftime:%Y-%m-%d %H-%M-%S}" appears to resolve the error and produces log streams with format:
Using highly unique log stream names will likely result in throttling by CloudWatch when creating the new log streams. A good balance may be to use {strftime:%Y-%m-%d} or {strftime:%Y-%m-%d-%H}.
Windows is unfortunately not directly supported by this library (WSL is supported). You can work around the issue with Windows program_name by not using program_name in your placeholder string.
The strftime behavior is expected. Yes, CloudWatch does not allow colons in the log stream name, and the Watchtower documentation correspondingly advises one to use a strftime format string with the strftime placeholder. I edited the documentation to more directly point out that using the default format string will result in an error.
Problem 1
program_name
Windows contains ":" in
program_name
of log stream name.For example,
C:\
log stream name should not have ":" and "*". In regex, [^:*]
So,
sys.argv[0]
causes an error in Windows.Solution 1
program_name
Remove all ":" in
sys.argv[0]
#207
Problem 2
strftime
strftime
of log stream name contains ":" becausedatetime.datetime.now()
contains ":"For example,
11:22:35
log stream name should not have ":" and "*". In regex, [^:*]
So,
datetime.datetime.now()
causes an error in Windows.Solution 2-1
strftime
Remove all ":" in
datetime.datetime.now()
However, you can't use
{strftime:%Y-%m-%d %H-%M-%S}
with editing.Solution 2-2
strftime
You can use
{strftime:%Y-%m-%d %H-%M-%S}
without editing.The text was updated successfully, but these errors were encountered: