diff --git a/nixos/modules/services/databases/victorialogs.nix b/nixos/modules/services/databases/victorialogs.nix index a7b6d3ced654c..eb6a54352172d 100644 --- a/nixos/modules/services/databases/victorialogs.nix +++ b/nixos/modules/services/databases/victorialogs.nix @@ -29,7 +29,7 @@ in { options.services.victorialogs = { enable = mkEnableOption "VictoriaLogs is an open source user-friendly database for logs from VictoriaMetrics"; - package = mkPackageOption pkgs "victoriametrics" { }; + package = mkPackageOption pkgs "victorialogs" { }; listenAddress = mkOption { default = ":9428"; type = types.str; diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 1c64ff4bda807..cfe872840b75f 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1458,6 +1458,7 @@ in vector = handleTest ./vector { }; velocity = runTest ./velocity.nix; vengi-tools = handleTest ./vengi-tools.nix { }; + victorialogs = runTest ./victorialogs.nix; victoriametrics = handleTest ./victoriametrics { }; vikunja = handleTest ./vikunja.nix { }; virtualbox = handleTestOn [ "x86_64-linux" ] ./virtualbox.nix { }; diff --git a/nixos/tests/victorialogs.nix b/nixos/tests/victorialogs.nix new file mode 100644 index 0000000000000..9545b61c402fc --- /dev/null +++ b/nixos/tests/victorialogs.nix @@ -0,0 +1,26 @@ +{ lib, ... }: +{ + name = "victorialogs"; + meta.maintainers = with lib.maintainers; [ marie ]; + + nodes.machine = + { pkgs, ... }: + { + services.victorialogs.enable = true; + + services.journald.upload = { + enable = true; + settings = { + Upload.URL = "http://localhost:9428/insert/journald"; + }; + }; + environment.systemPackages = [ pkgs.curl ]; + }; + + testScript = '' + machine.wait_for_unit("victorialogs.service") + + machine.succeed("echo 'meow' | systemd-cat -p info") + machine.wait_until_succeeds("curl --fail http://localhost:9428/select/logsql/query -d 'query=\"meow\"' | grep meow") + ''; +} diff --git a/pkgs/by-name/vi/victorialogs/package.nix b/pkgs/by-name/vi/victorialogs/package.nix new file mode 100644 index 0000000000000..c4723ac7b76d5 --- /dev/null +++ b/pkgs/by-name/vi/victorialogs/package.nix @@ -0,0 +1,72 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + nix-update-script, + nixosTests, + withServer ? true, + withVlAgent ? false, +}: + +buildGoModule (finalAttrs: { + pname = "VictoriaLogs"; + version = "1.36.1"; + + src = fetchFromGitHub { + owner = "VictoriaMetrics"; + repo = "VictoriaLogs"; + tag = "v${finalAttrs.version}"; + hash = "sha256-TZhgZ8x1ESXrNMU6Sa4cQMurTZ+obD/JqqIJFJ18KOA="; + }; + + vendorHash = null; + + subPackages = + lib.optionals withServer [ + "app/victoria-logs" + "app/vlinsert" + "app/vlselect" + "app/vlstorage" + "app/vlogsgenerator" + "app/vlogscli" + ] + ++ lib.optionals withVlAgent [ "app/vlagent" ]; + + postPatch = '' + # Allow older go versions + substituteInPlace go.mod \ + --replace-fail "go 1.25.2" "go ${finalAttrs.passthru.go.version}" + + substituteInPlace vendor/modules.txt \ + --replace-fail "go 1.25.0" "go ${finalAttrs.passthru.go.version}" + ''; + + ldflags = [ + "-s" + "-w" + "-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=${finalAttrs.version}" + ]; + + __darwinAllowLocalNetworking = true; + + passthru = { + tests = { + inherit (nixosTests) + victorialogs + ; + }; + updateScript = nix-update-script { }; + }; + + meta = { + homepage = "https://docs.victoriametrics.com/victorialogs/"; + description = "User friendly log database from VictoriaMetrics"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ + marie + shawn8901 + ]; + changelog = "https://github.com/VictoriaMetrics/VictoriaLogs/releases/tag/${finalAttrs.src.tag}"; + mainProgram = "victoria-logs"; + }; +}) diff --git a/pkgs/by-name/vl/vlagent/package.nix b/pkgs/by-name/vl/vlagent/package.nix new file mode 100644 index 0000000000000..0f52476451077 --- /dev/null +++ b/pkgs/by-name/vl/vlagent/package.nix @@ -0,0 +1,11 @@ +{ lib, victorialogs }: + +# This package is build out of the victorialogs package. +# so no separate update prs are needed for vlagent +# nixpkgs-update: no auto update +lib.addMetaAttrs { mainProgram = "vlagent"; } ( + victorialogs.override { + withServer = false; + withVlAgent = true; + } +)