Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept configuration file path as an argument #2123

Open
shinebayar-g opened this issue Nov 16, 2024 · 4 comments
Open

Accept configuration file path as an argument #2123

shinebayar-g opened this issue Nov 16, 2024 · 4 comments
Labels
enhancement New feature or request needs-attention

Comments

@shinebayar-g
Copy link
Contributor

Request

It seems /etc/alloy/config.alloy is hardcoded and there is no way to pass a custom location.

Use case

I want to put configuration file in the same directory as Alloy instance as I don't have access to /etc/ directory.

@shinebayar-g shinebayar-g added the enhancement New feature or request label Nov 16, 2024
@dehaansa
Copy link
Contributor

Can you explain how you're running Alloy? The configuration is provided to the run command in the first argument, like the following.

./alloy run /another/directory/my_config.alloy

@shinebayar-g
Copy link
Contributor Author

shinebayar-g commented Nov 16, 2024

Just running the binary like ./alloy-linux-amd64. If that's the case, it's not documented at all.

❯ ./alloy-linux-amd64 --help
Grafana Alloy

Usage:
  ./alloy-linux-amd64 [global options] <subcommand> [flags]
  ./alloy-linux-amd64 [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  convert     Convert a supported config file to Alloy
  fmt         Format a configuration file
  help        Help about any command
  run         Run Grafana Alloy
  tools       Utilties for various components

Flags:
  -h, --help      help for ./alloy-linux-amd64
  -v, --version   version for ./alloy-linux-amd64

Use "./alloy-linux-amd64 [command] --help" for more information about a command.

./alloy-linux-amd64 run --help doesn't mention anything about configuration.

@dehaansa
Copy link
Contributor

So the documentation lists it here and here and on my environment I see the following for run --help. The first paragraph specifies that the provided argument specifies the configuration file/directory. That said, it doesn't say anything about the default path (and says if not specified it will exit), so I'll make sure we take a look at that!

./alloy run --help
The run subcommand runs Grafana Alloy in the foreground until an interrupt
is received.

run must be provided an argument pointing at the Alloy configuration
directory or file path to use. If the configuration directory or file path
wasn't specified, can't be loaded, or contains errors, run will exit
immediately.

If path is a directory, all *.alloy files in that directory will be combined
into a single unit. Subdirectories are not recursively searched for further merging.

run starts an HTTP server which can be used to debug Grafana Alloy or
force it to reload (by sending a GET or POST request to /-/reload). The listen
address can be changed through the --server.http.listen-addr flag.

By default, the HTTP server exposes a debugging UI at /. The path of the
debugging UI can be changed by providing a different value to
--server.http.ui-path-prefix.

Additionally, the HTTP server exposes the following debug endpoints:

  /debug/pprof   Go performance profiling tools

If reloading the config dir/file-path fails, Grafana Alloy will continue running in
its last valid state. Components which failed may be be listed as unhealthy,
depending on the nature of the reload error.

Usage:
  ./build/alloy run [flags] path

Flags:
      ...

Copy link
Contributor

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it.
If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue.
The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-attention
Projects
None yet
Development

No branches or pull requests

2 participants