ashb edited a comment on issue #14502:
URL: https://github.com/apache/airflow/issues/14502#issuecomment-787937974
```python console
In [25]: fragment
Out[25]:
'logsV2:logs-insights$3FqueryDetail$3D$257E$2528end$257E$25272021-02-27T09*3a59*3a59.000Z$257Estart$257E$25272021-02-27T09*3a00*3a00.000Z$257EtimeType$257E$2527ABSOLUTE$257Etz$257E$2527Local$257EeditorString$257E$2527fields*20*40timestamp*2c*20message*0a*7c*20filter*20*40logStream*20*3d*20*27ip-172-31-16-53*27*0a*7c*20sort*20*40timestamp*20desc*0a*7c*20limit*2010000$257EisLiveTail$257Efalse$257EqueryId$257E$2527582c4f04-c056-4614-97cc-16916474edde$257Esource$257E$2528$257E$2527GitHubRunners$2529$2529'
In [26]: re.sub(r'\$([0-9A-F]{2})', lambda x: chr(int(x.group(1), 16)),
re.sub(r'\$25([0-9A-F]{2})', lambda x: chr(int(x.group(1), 16)), fragment))
Out[26]:
"logsV2:logs-insights?queryDetail=~(end~'2021-02-27T09*3a59*3a59.000Z~start~'2021-02-27T09*3a00*3a00.000Z~timeType~'ABSOLUTE~tz~'Local~editorString~'fields*20*40timestamp*2c*20message*0a*7c*20filter*20*40logStream*20*3d*20*27ip-172-31-16-53*27*0a*7c*20sort*20*40timestamp*20desc*0a*7c*20limit*2010000~isLiveTail~false~queryId~'582c4f04-c056-4614-97cc-16916474edde~source~(~'GitHubRunners))"
```
So there's at least three levels of escaping going on here. `$2528` is the
query-string equiv of `%2528` - `'\x28'` is a bracket.
I think `*3a` is the next level of escaping, and `'\x3a'` is `:`.
```python console
re.split(r"~'?", urllib.parse.urlparse('://'+_26).query)
Out[48]:
['queryDetail=',
'(end',
'2021-02-27T09*3a59*3a59.000Z',
'start',
'2021-02-27T09*3a00*3a00.000Z',
'timeType',
'ABSOLUTE',
'tz',
'Local',
'editorString',
'fields*20*40timestamp*2c*20message*0a*7c*20filter*20*40logStream*20*3d*20*27ip-172-31-16-53*27*0a*7c*20sort*20*40timestamp*20desc*0a*7c*20limit*2010000',
'isLiveTail',
'false',
'queryId',
'582c4f04-c056-4614-97cc-16916474edde',
'source',
'(',
'GitHubRunners))']
In [49]: _48[11]
Out[49]: 'isLiveTail'
In [50]: _48[10]
Out[50]:
'fields*20*40timestamp*2c*20message*0a*7c*20filter*20*40logStream*20*3d*20*27ip-172-31-16-53*27*0a*7c*20sort*20*40timestamp*20desc*0a*7c*20limit*2010000'
In [51]: re.sub(r'\*([0-9a-f]{2})', lambda x: chr(int(x.group(1), 16)),
_48[10])
Out[51]: "fields @timestamp, message\n| filter @logStream =
'ip-172-31-16-53'\n| sort @timestamp desc\n| limit 10000"
```
Bits we would need to replace/sub in. The start/end times, and the logStream
name in the editorString.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]