[08:06:40] !log tools Published new toolforge-bullseye0-run and toolforge-bullseye0-build images for the toolforge buildpack builder (T316854) [08:06:43] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools/SAL [08:06:43] T316854: [tbs.buildpacks] The uwsgi buildpack is failing to run due to missing Python.h library - https://phabricator.wikimedia.org/T316854 [15:09:48] My uwsgi.log file has 6 months worth of log data in it. Is there some way to configure things so the uwsgi.log file rotates once a week or whatever? [15:14:06] roy649: I'm guessing that you are talking about toolforge (if not, please let me know). You can setup uwsgi to rotate the logs for you, see https://uwsgi-docs.readthedocs.io/en/latest/Logging.html#logging-to-files [15:14:18] yes, toolforge [15:14:43] thanks [15:16:12] in case you are not familiar, you can create a uwsgi.ini file with the settings (see https://wikitech.wikimedia.org/wiki/Help:Toolforge/Web/Python#Conventions) [15:16:42] ah, I was just typing that question :-) [15:17:10] xd πŸ‘ [15:19:39] So I would put: [15:19:46] logger = file:logfile=/tmp/uwsgi.log,maxsize=2000000 [15:20:07] in my www/python/uwsgi.ini file? [15:20:19] I'm not sure that log rotation actually works for uwsgi on Toolforge, but it is worth someone testing that out. We've found problems in past of uwsgi not always allowing values set in the default settings generated by `webservice` to be overwritten by a $HOME/www/python/uwsgi.ini file [15:21:45] Is the line above at least the correct syntax? [15:25:32] it does, I use it, let me grab the config [15:25:51] https://github.com/AntiCompositeNumber/anticompositetools/blob/master/uwsgi.ini [15:26:26] cool, thanks. [15:26:42] and yeah, that goes in ~/www/python/uwsgi.ini [15:26:46] While I'm in there, is is also possible to over-ride $HOME/uwsgi.log as the location of the log file? [15:27:38] AntiComposite: thanks for sharing. that seems like it a thing worthy of putting on wikitech somewhere. Maybe under https://wikitech.wikimedia.org/wiki/Help:Toolforge/Web/Python#Logs? [15:28:17] where do you want it? (remember that the home directory of the tool is what's mounted on the exec containers, so /tmp and similar will not be synced back to the bastion hosts) [15:28:23] πŸ‘ for documenting that [15:28:56] (I can add the docs note if you are busy) [15:29:11] * dcaro procrastinating a bit xd [15:29:16] I keep my django logs in $HOME/logs/django/, so I figured $HOME/logs/uwsgi/ would make sense [15:34:03] should work I think yes, though might not like the $HOME in the path, you can use the full path of the tool home if that does not work [15:34:16] (I was looking at the code of the webservice to see how it's started) [15:38:40] OK, I'll give it a try, thanks. [15:41:59] added to wikitech [15:44:44] AntiComposite: thanks! [16:11:42] dcaro, AntiComposite: nice, thanks! much better than rotating them manually [16:12:07] unfortunately you still have to clean them up manually, but that's certainly easier [16:12:30] yeah, and if uwsgi takes care of the rotating for me, it’s much easier for me to zstd the file [16:13:07] * Lucas_WMDE used to rotate with tedious shell scripts to pick out hand-selected line number ranges [16:37:43] In here I am :) [16:38:13] indeed, welcome [17:08:58] I'm still confused about how the config.ini files work. [17:09:07] https://uwsgi-docs.readthedocs.io/en/latest/Logging.html talks about: [17:09:12] https://uwsgi-docs.readthedocs.io/en/latest/Logging.html [17:09:20] uwsgi --socket :3031 --logger file:logfile=/tmp/uwsgi.log,maxsize=2000000 [17:09:30] But in config.ini, you put: [17:09:40] log-maxsize = 10485760 [17:10:07] How do you map from the format documented in readthedocs to the format you put in config.ini? [18:10:20] roy649: that is because there a specific option for that, you could also have used the logfile option in the config file "logfile = /tmp/uwsgi.log,maxsize=2000000"(see https://uwsgi-docs.readthedocs.io/en/latest/Configuration.html and `uwsgi --help` for all options) [18:10:46] Ah. [18:10:58] much appreciated. [18:56:15] Maybe I'm just being exceptionally clueless today, but I don't see anywhere in https://uwsgi-docs.readthedocs.io/en/latest/Logging.html that talks about "log-maxsize" [18:57:39] the uwsgi docs are...not entirely great [18:57:51] https://uwsgi-docs.readthedocs.io/en/latest/Options.html?highlight=log-maxsize#log-maxsize is it [18:58:29] k [19:01:35] Success! [19:01:36] log-maxsize = 10485760 [19:01:37] logto = /data/project/spi-tools-dev/logs/uwsgi/uwsgi.log [19:01:42] that seems to work. [19:02:18] why it's "logto" and not "log-to", I have no clue :-) [19:25:43] I was thinking about these uwsgi logging questions and my caution that it might not work. I finally remembered specifics, and that was that I wanted to send logs to stderr so that Kubernetes would collect them rather than sending to disk. The problem with that is that there is no way to remove the default `--logto` that is setup by `webservice`. [19:27:15] The other thing I was confusing this with is lighttpd $HOME/.lighttpd.conf override behavior where some settings are immutable [20:54:15] so it turns out you can set logto to /dev/stderr, and it'll work [20:54:44] only thing it it'll try to check if it needs to logrotate /dev/stderr, and will try to lseek it [20:55:25] of course it's not a real file, so that doesn't work, and it'll rapidly spam errors [20:55:48] but if you just use log-drain to hide those errors it'll probably be fine Β―\_(ツ)_/Β―