)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":20676,"name":"daniel.pawlik","display_name":"Daniel Pawlik","email":"dpawlik@redhat.com","username":"daniel.pawlik"},"change_message_id":"235434d0a69b56bec19b78aaf39689be05982abb","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":15,"id":"358585f1_4ed151e8","updated":"2022-03-24 13:06:09.000000000","message":"recheck","commit_id":"3a5f2076df63371fd0391049dc20c491870755c3"},{"author":{"_account_id":9311,"name":"Tristan Cacqueray","email":"tdecacqu@redhat.com","username":"tristanC"},"change_message_id":"eeeb565868c336ca9bcbfb437130cf8bfee6d3f7","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":23,"id":"1306fea3_d05b9df3","updated":"2022-03-25 18:32:42.000000000","message":"I left a couple of nits and one suggestion, otherwise that looks great to me. Thanks!","commit_id":"557cda54d8837aee73559d8339d66f99d5779c10"}],"logscraper/logsender.py":[{"author":{"_account_id":9311,"name":"Tristan Cacqueray","email":"tdecacqu@redhat.com","username":"tristanC"},"change_message_id":"750de85e24fa2489632013f1004388bab97f6251","unresolved":true,"context_lines":[{"line_number":195,"context_line":"    return datetime.datetime.fromisoformat(timestamp).isoformat()"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"def get_timestamp(line, file_timeformat, text_timeformat):"},{"line_number":199,"context_line":"    try:"},{"line_number":200,"context_line":"        if file_timeformat \u003d\u003d \u0027isoformat\u0027:"},{"line_number":201,"context_line":"            return line.split(\"|\", 1)[0].replace(\u0027 \u0027, \u0027\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"f2561fcf_5fed298c","line":198,"updated":"2022-03-21 12:23:30.000000000","message":"I\u0027m not sure how it is useful to enable timestamp format configuration. Perhaps it would be more flexible if the logsender would try all the alternative so that it works for any format.\n\nI think that would be better if the timestamp format change in future version of devstack.","commit_id":"94b859be45d822821c287d023fe69ed839a3800c"},{"author":{"_account_id":20676,"name":"daniel.pawlik","display_name":"Daniel Pawlik","email":"dpawlik@redhat.com","username":"daniel.pawlik"},"change_message_id":"d9f1e71c7222a680f1f16e28d96f009d1228c4f9","unresolved":false,"context_lines":[{"line_number":195,"context_line":"    return datetime.datetime.fromisoformat(timestamp).isoformat()"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"def get_timestamp(line, file_timeformat, text_timeformat):"},{"line_number":199,"context_line":"    try:"},{"line_number":200,"context_line":"        if file_timeformat \u003d\u003d \u0027isoformat\u0027:"},{"line_number":201,"context_line":"            return line.split(\"|\", 1)[0].replace(\u0027 \u0027, \u0027\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"d7e9cd96_15106043","line":198,"in_reply_to":"347f7524_f40a221f","updated":"2022-03-24 12:42:43.000000000","message":"Done","commit_id":"94b859be45d822821c287d023fe69ed839a3800c"},{"author":{"_account_id":9311,"name":"Tristan Cacqueray","email":"tdecacqu@redhat.com","username":"tristanC"},"change_message_id":"a28164a44651373e9840eca94d0b568150a9ebad","unresolved":true,"context_lines":[{"line_number":195,"context_line":"    return datetime.datetime.fromisoformat(timestamp).isoformat()"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"def get_timestamp(line, file_timeformat, text_timeformat):"},{"line_number":199,"context_line":"    try:"},{"line_number":200,"context_line":"        if file_timeformat \u003d\u003d \u0027isoformat\u0027:"},{"line_number":201,"context_line":"            return line.split(\"|\", 1)[0].replace(\u0027 \u0027, \u0027\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"347f7524_f40a221f","line":198,"in_reply_to":"3a79604a_4e406ec3","updated":"2022-03-23 13:47:52.000000000","message":"You don\u0027t have to ask the community to change the time formatting. I meant that instead of managing a custom configuration per file type, the function can try to parse all the known timestamps, so that it would work with any file type, even when they change in the future.","commit_id":"94b859be45d822821c287d023fe69ed839a3800c"},{"author":{"_account_id":20676,"name":"daniel.pawlik","display_name":"Daniel Pawlik","email":"dpawlik@redhat.com","username":"daniel.pawlik"},"change_message_id":"f11c4ec4784e4caab009eae779ce7675f6cb0bb1","unresolved":true,"context_lines":[{"line_number":195,"context_line":"    return datetime.datetime.fromisoformat(timestamp).isoformat()"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"def get_timestamp(line, file_timeformat, text_timeformat):"},{"line_number":199,"context_line":"    try:"},{"line_number":200,"context_line":"        if file_timeformat \u003d\u003d \u0027isoformat\u0027:"},{"line_number":201,"context_line":"            return line.split(\"|\", 1)[0].replace(\u0027 \u0027, \u0027\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a79604a_4e406ec3","line":198,"in_reply_to":"f2561fcf_5fed298c","updated":"2022-03-23 12:56:50.000000000","message":"it would be difficult to ask devstack community to change the time formatting, but I can try. For sure, it will take some time and will be not applied for all branches, so the time formatting for it needs to be as it is.","commit_id":"94b859be45d822821c287d023fe69ed839a3800c"},{"author":{"_account_id":20676,"name":"daniel.pawlik","display_name":"Daniel Pawlik","email":"dpawlik@redhat.com","username":"daniel.pawlik"},"change_message_id":"1533f86cb52f0b13f0638e6ba0ef1e8694c92372","unresolved":true,"context_lines":[{"line_number":201,"context_line":"                year\u003ddatetime.date.today().year).isoformat()"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"def get_timestamp(line):"},{"line_number":205,"context_line":"    \"\"\"Parse log time format like and return in iso format\"\"\""},{"line_number":206,"context_line":"    try:"},{"line_number":207,"context_line":"        # iso format, eg."}],"source_content_type":"text/x-python","patch_set":19,"id":"8f2e75a6_7e99a5c4","line":204,"updated":"2022-03-25 13:17:58.000000000","message":"it should try to parse log date with formats https://opendev.org/openstack/logstash-filters/src/branch/master/filters/openstack-filters.conf#L85-L96","commit_id":"f363a7038c1c44d682de975b82f337df1080272a"},{"author":{"_account_id":20676,"name":"daniel.pawlik","display_name":"Daniel Pawlik","email":"dpawlik@redhat.com","username":"daniel.pawlik"},"change_message_id":"866377dcf51a325a1797dc451e422bf02943c386","unresolved":false,"context_lines":[{"line_number":201,"context_line":"                year\u003ddatetime.date.today().year).isoformat()"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"def get_timestamp(line):"},{"line_number":205,"context_line":"    \"\"\"Parse log time format like and return in iso format\"\"\""},{"line_number":206,"context_line":"    try:"},{"line_number":207,"context_line":"        # iso format, eg."}],"source_content_type":"text/x-python","patch_set":19,"id":"ff4ecf5c_d5b42f9c","line":204,"in_reply_to":"8f2e75a6_7e99a5c4","updated":"2022-03-25 16:45:29.000000000","message":"Done","commit_id":"f363a7038c1c44d682de975b82f337df1080272a"},{"author":{"_account_id":9311,"name":"Tristan Cacqueray","email":"tdecacqu@redhat.com","username":"tristanC"},"change_message_id":"eeeb565868c336ca9bcbfb437130cf8bfee6d3f7","unresolved":true,"context_lines":[{"line_number":221,"context_line":"        if text_timeformat:"},{"line_number":222,"context_line":"            return text_timeformat"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        found_date \u003d list(datefinder.find_dates(line))"},{"line_number":225,"context_line":"        if found_date:"},{"line_number":226,"context_line":"            return found_date[0]"},{"line_number":227,"context_line":"    except TypeError:"}],"source_content_type":"text/x-python","patch_set":23,"id":"02544a07_e67b1812","line":224,"updated":"2022-03-25 18:32:42.000000000","message":"isn\u0027t this going to find any date in the log lines, not just the prefix timestamp?","commit_id":"557cda54d8837aee73559d8339d66f99d5779c10"},{"author":{"_account_id":20676,"name":"daniel.pawlik","display_name":"Daniel Pawlik","email":"dpawlik@redhat.com","username":"daniel.pawlik"},"change_message_id":"cb1d571b8bbffb340eefcb67f6b75105c75efaaf","unresolved":false,"context_lines":[{"line_number":221,"context_line":"        if text_timeformat:"},{"line_number":222,"context_line":"            return text_timeformat"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        found_date \u003d list(datefinder.find_dates(line))"},{"line_number":225,"context_line":"        if found_date:"},{"line_number":226,"context_line":"            return found_date[0]"},{"line_number":227,"context_line":"    except TypeError:"}],"source_content_type":"text/x-python","patch_set":23,"id":"89fbd5bd_731db09b","line":224,"in_reply_to":"02544a07_e67b1812","updated":"2022-03-28 06:30:05.000000000","message":"yes, but good it will take first one. Even when it find a date in header in syslog.txt file we can go with it, because the date is same as other logs.\nAlso the datefinder returns generator, I will do another PS that will use it","commit_id":"557cda54d8837aee73559d8339d66f99d5779c10"},{"author":{"_account_id":9311,"name":"Tristan Cacqueray","email":"tdecacqu@redhat.com","username":"tristanC"},"change_message_id":"eeeb565868c336ca9bcbfb437130cf8bfee6d3f7","unresolved":true,"context_lines":[{"line_number":233,"context_line":"    time \u003d find_time_in_line(line)"},{"line_number":234,"context_line":"    if time and isinstance(time, datetime.datetime):"},{"line_number":235,"context_line":"        return time.isoformat(sep\u003d\u0027T\u0027, timespec\u003d\u0027milliseconds\u0027).replace("},{"line_number":236,"context_line":"            \u0027+00:00\u0027, \u0027\u0027)"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":""},{"line_number":239,"context_line":"def get_message(line):"}],"source_content_type":"text/x-python","patch_set":23,"id":"05b43585_fbc8f980","line":236,"updated":"2022-03-25 18:32:42.000000000","message":"I think you can achieve a similar result with this dependency-free implementation:\n\n    timestamp_patterns \u003d [\n        # Mar 25 17:40:37\n        (re.compile(r\"(\\S+ \\S+ \\S_)\"), \"%b %d %H:%M:%S\"),\n        # 2022-03-25T17:40:37\n        (re.compile(r\"(\\S+)\"), \"%Y-%m-%dT%H:%M:%S\"),\n        # 2022-03-25\n        (re.compile(r\"(\\S+)\"), \"%Y-%m-%d\"),\n    ]\n\n\n    def get_timestamp(line):\n        for (regex, fmt) in timestamp_patterns:\n            try:\n                if match :\u003d regex.match(line):\n                    timestamp_string \u003d match.groups()[0].rstrip(\u0027Z\u0027)\n                    return datetime.datetime.strptime(timestamp_string, fmt)\n            except ValueError:\n                pass","commit_id":"557cda54d8837aee73559d8339d66f99d5779c10"},{"author":{"_account_id":20676,"name":"daniel.pawlik","display_name":"Daniel Pawlik","email":"dpawlik@redhat.com","username":"daniel.pawlik"},"change_message_id":"cb1d571b8bbffb340eefcb67f6b75105c75efaaf","unresolved":true,"context_lines":[{"line_number":233,"context_line":"    time \u003d find_time_in_line(line)"},{"line_number":234,"context_line":"    if time and isinstance(time, datetime.datetime):"},{"line_number":235,"context_line":"        return time.isoformat(sep\u003d\u0027T\u0027, timespec\u003d\u0027milliseconds\u0027).replace("},{"line_number":236,"context_line":"            \u0027+00:00\u0027, \u0027\u0027)"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":""},{"line_number":239,"context_line":"def get_message(line):"}],"source_content_type":"text/x-python","patch_set":23,"id":"2089ad63_487d32e2","line":236,"in_reply_to":"05b43585_fbc8f980","updated":"2022-03-28 06:30:05.000000000","message":"I tried with similar regex, but still some logs have \"unexpected\" time stamps, that should be later updated.\nI have done a simple test https://paste.openstack.org/show/bLKQKjE66YWAU5tnElFj/ (I know, it\u0027s ugly) and it is just a part of the logs that we are taking. If in the future, some service will be updated and it will change time format, it will require one more ps... Maybe let\u0027s try with this approach.","commit_id":"557cda54d8837aee73559d8339d66f99d5779c10"},{"author":{"_account_id":9311,"name":"Tristan Cacqueray","email":"tdecacqu@redhat.com","username":"tristanC"},"change_message_id":"acb31d65285ddbdf192cb1c1088b104597004cd3","unresolved":true,"context_lines":[{"line_number":233,"context_line":"    time \u003d find_time_in_line(line)"},{"line_number":234,"context_line":"    if time and isinstance(time, datetime.datetime):"},{"line_number":235,"context_line":"        return time.isoformat(sep\u003d\u0027T\u0027, timespec\u003d\u0027milliseconds\u0027).replace("},{"line_number":236,"context_line":"            \u0027+00:00\u0027, \u0027\u0027)"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":""},{"line_number":239,"context_line":"def get_message(line):"}],"source_content_type":"text/x-python","patch_set":23,"id":"ec925a55_a010dfbe","line":236,"in_reply_to":"2089ad63_487d32e2","updated":"2022-03-28 12:27:16.000000000","message":"What are the \"unexpected\" time stamps?","commit_id":"557cda54d8837aee73559d8339d66f99d5779c10"},{"author":{"_account_id":9311,"name":"Tristan Cacqueray","email":"tdecacqu@redhat.com","username":"tristanC"},"change_message_id":"eeeb565868c336ca9bcbfb437130cf8bfee6d3f7","unresolved":true,"context_lines":[{"line_number":238,"context_line":""},{"line_number":239,"context_line":"def get_message(line):"},{"line_number":240,"context_line":"    try:"},{"line_number":241,"context_line":"        return line.split(\"|\", 1)[1].replace(\u0027\\n\u0027, \u0027\u0027).lstrip()"},{"line_number":242,"context_line":"    except IndexError:"},{"line_number":243,"context_line":"        return line.replace(\u0027\\n\u0027, \u0027\u0027)"},{"line_number":244,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"4c3a5156_cce184e2","line":241,"updated":"2022-03-25 18:32:42.000000000","message":"nit: Perhaps we could just `strip` for the same effect. And since we are doing that on the other branch, i think this should be:\n\n  try:\n    line \u003d line.split(\"|\", 1)[1]\n  except IndexError:\n    pass\n  return line.strip()","commit_id":"557cda54d8837aee73559d8339d66f99d5779c10"},{"author":{"_account_id":20676,"name":"daniel.pawlik","display_name":"Daniel Pawlik","email":"dpawlik@redhat.com","username":"daniel.pawlik"},"change_message_id":"cb1d571b8bbffb340eefcb67f6b75105c75efaaf","unresolved":false,"context_lines":[{"line_number":238,"context_line":""},{"line_number":239,"context_line":"def get_message(line):"},{"line_number":240,"context_line":"    try:"},{"line_number":241,"context_line":"        return line.split(\"|\", 1)[1].replace(\u0027\\n\u0027, \u0027\u0027).lstrip()"},{"line_number":242,"context_line":"    except IndexError:"},{"line_number":243,"context_line":"        return line.replace(\u0027\\n\u0027, \u0027\u0027)"},{"line_number":244,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"a2792e42_8c8670de","line":241,"in_reply_to":"4c3a5156_cce184e2","updated":"2022-03-28 06:30:05.000000000","message":"good idea. Will do in another PS","commit_id":"557cda54d8837aee73559d8339d66f99d5779c10"}]}
