diff options
author | Florian Klink <flokli@flokli.de> | 2023-11-12T16·09+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-11-12T16·46+0000 |
commit | e4adca0880547f2ea825aeec5f64671c6c0324ae (patch) | |
tree | ea2e140e4ff6394afb3aed040130e3c66fa085a0 /users/flokli/nixos/archeology-ec2/configuration.nix | |
parent | 3fe455cd4ada32990f67af640becd4cf8ae6117c (diff) |
feat(users/flokli/nixos/archeology-ec2): automate bucket log parsing r/6996
This adds a `parse-bucket-logs.{service,timer}`, running once every night at 3AM UTC, figuring out the last time it was run and parsing bucket logs for all previous days. It invokes the `archeology-parse-bucket-logs` script to produce a .parquet file with the bucket logs in `s3://nix-cache-log/log/` for that day (inside a temporary directory), then on success uploads the produced parquet file to `s3://nix-archeologist/nix-cache-bucket-logs/yyyy-mm-dd.parquet`. Change-Id: Ia75ca8c43f8074fbaa34537ffdba68350c504e52 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10011 Reviewed-by: edef <edef@edef.eu> Tested-by: BuildkiteCI
Diffstat (limited to 'users/flokli/nixos/archeology-ec2/configuration.nix')
-rw-r--r-- | users/flokli/nixos/archeology-ec2/configuration.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/users/flokli/nixos/archeology-ec2/configuration.nix b/users/flokli/nixos/archeology-ec2/configuration.nix index af10771adc44..f0fc0c5d095c 100644 --- a/users/flokli/nixos/archeology-ec2/configuration.nix +++ b/users/flokli/nixos/archeology-ec2/configuration.nix @@ -6,6 +6,24 @@ ../profiles/archeology.nix ]; + systemd.timers.parse-bucket-logs = { + wantedBy = [ "multi-user.target" ]; + timerConfig.OnCalendar = "*-*-* 03:00:00 UTC"; + }; + + systemd.services.parse-bucket-logs = { + path = [ depot.users.flokli.archeology.parse-bucket-logs ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = (pkgs.writers.writePython3 "parse-bucket-logs-continuously" + { + libraries = [ pkgs.python3Packages.boto3 ]; + } ./parse-bucket-logs-continuously.py); + DynamicUser = "yes"; + StateDirectory = "parse-bucket-logs"; + }; + }; + environment.systemPackages = [ depot.users.flokli.archeology.parse-bucket-logs ]; |