jorgebastida / jorgebastida/awslogs

Specifying asterisk as query causes error

Open
#217 4 comments 2 reactions 0 assignees View on GitHub
enhancement help
Dominant language
Python
Stars
5k
Forks
342
PR merge metrics
No merged PRs in 30d

Description

I ran `awslogs get MY_STREAM_NAME '*'` and error as below:
```
Version: 0.10.0
Python: 3.7.0 (default, Jul 15 2018, 10:44:58)
[GCC 8.1.1 20180531]
boto3 version: 1.9.10
Platform: Linux-4.14.70-1-MANJARO-x86_64-with-arch-Manjaro-Linux
Config: {'aws_access_key_id': 'SENSITIVE', 'aws_secret_access_key': 'SENSITIVE', 'aws_session_token': 'SENSITIVE', 'aws_profile': 'SENSITIVE', 'aws_region': None, 'log_group_name': 'MY_STREAM_NAME', 'log_stream_name': '*', 'filter_pattern': None, 'watch': False, 'output_group_enabled': True, 'output_stream_enabled': True, 'output_timestamp_enabled': False, 'output_ingestion_time_enabled': False, 'start': '5m', 'end': None, 'color_enabled': True, 'query': None, 'func': 'list_logs'}
Args: ['/home/picosushi/.local/bin/awslogs', 'get', 'MY_STREAM_NAME', '*']

Traceback (most recent call last):
File "/home/picosushi/.local/lib/python3.7/site-packages/awslogs/bin.py", line 172, in main
getattr(logs, options.func)()
File "/home/picosushi/.local/lib/python3.7/site-packages/awslogs/core.py", line 76, in list_logs
streams = list(self._get_streams_from_pattern(self.log_group_name, self.log_stream_name))
File "/home/picosushi/.local/lib/python3.7/site-packages/awslogs/core.py", line 68, in _get_streams_from_pattern
reg = re.compile('^{0}'.format(pattern))
File "/usr/lib/python3.7/re.py", line 234, in compile
return _compile(pattern, flags)
File "/usr/lib/python3.7/re.py", line 286, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.7/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.7/sre_parse.py", line 930, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.7/sre_parse.py", line 426, in _parse_sub
not nested and not items))
File "/usr/lib/python3.7/sre_parse.py", line 651, in _parse
source.tell() - here + len(this))
re.error: nothing to repeat at position 1
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with awslogs/core.py at _get_streams_from_pattern and list_logs, then reproduce `awslogs get MY_STREAM_NAME '*'` to inspect the reported regular-expression failure. Done means the command no longer errors when `*` is supplied as the stream pattern and the expected logs can be listed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.