|
|
Строка 2: |
Строка 2: |
| === 2020-10 === | | === 2020-10 === |
| | | |
| + | * 2020-10-29, 00:09:15: [https://stackoverflow.com/questions/36327265/python-parse-log-file-in-realtime-reload-when-the-log-rotates Python Parse log file in realtime, reload when the log rotates - Stack Overflow] |
| + | *: <html><span class="hljs-keyword">import</span> os file_path = <span class="hljs-string">'/var/log/app/access.log'</span> <span class="hljs-keyword">with</span> open(file_path) <span class="hljs-keyword">as</span> f: file_size = <span class="hljs-number">0</span> <span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>: line = f.readline() <span class="hljs-keyword">if</span> line: <span class="hljs-keyword">print</span> line file_status_obj = os.stat(file_path) <span class="hljs-keyword">if</span> file_size < file_status_obj.st_size: f.seek(<span class="hljs-number">0</span>) file_size = file_status_obj.st_size </html> |
| + | <!-- NEXT BOOKMARK --> |
| * 2020-10-28, 23:11:37: [https://github.com/Rune28/Uchi/blob/c955d157c1ad85db19cbbece9e61cb8924ad4e40/event_data_parser.py Uchi/event_data_parser.py at c955d157c1ad85db19cbbece9e61cb8924ad4e40 · Rune28/Uchi] | | * 2020-10-28, 23:11:37: [https://github.com/Rune28/Uchi/blob/c955d157c1ad85db19cbbece9e61cb8924ad4e40/event_data_parser.py Uchi/event_data_parser.py at c955d157c1ad85db19cbbece9e61cb8924ad4e40 · Rune28/Uchi] |
| * 2020-10-28, 23:08:22: [https://github.com/search?l=Python&p=10&q=clickhouse_driver&type=Code Search · clickhouse_driver] | | * 2020-10-28, 23:08:22: [https://github.com/search?l=Python&p=10&q=clickhouse_driver&type=Code Search · clickhouse_driver] |