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

Run Elastic Agent in otel mode as a service #4933

Open
strawgate opened this issue Jun 13, 2024 · 11 comments
Open

Run Elastic Agent in otel mode as a service #4933

strawgate opened this issue Jun 13, 2024 · 11 comments
Assignees
Labels
Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@strawgate
Copy link
Contributor

strawgate commented Jun 13, 2024

As an OTel user, I configure my otel.yml with my desired configuration and iterate on the output until I'm happy with what I've got. Now I want to run the Collector as a service on the device instead of as a one-off. How do i run Elastic Agent in OTel mode as a service with the desired OTel config?

More specific details:
We can run Elastic-Agent via ./otelcol now which is great but when you finally love how everything is working you will want to stop running Elastic-Agent in OTel mode from the shell but to install Elastic-Agent and have it run in otel-mode.

./otelcol install and elastic-agent install just installs normal Elastic Agent unit/service files that do not contain the otel subcommand before invoking elastic-agent meaning I cannot easily run Elastic-Agent in OTel-mode as a service.

I need a convenient way to go from prototyping in my shell to running as a service without having to hand build services, unit files, etc.

Thoughts:
Co-opting our existing ./elastic-agent install command to conditionally (a flag?) insert the otel subcommand into units/services seems like a reasonable way to enable installation of Elastic Agent and run it in OTel mode.

Perhaps we should remove otel.yml and auto invoke otel subcommand when it's present?
Or bifurcate the unit/service files for installation via something like ./elastic-agent install --otel and then modify the otelcol bash scripts to check if install was passed and run the new subcommand so we can avoid ./otelcol install --otel

@ycombinator
Copy link
Contributor

I'm not following the requirements for this issue. ./otelcol is a shortcut to ./elastic-agent otel, which runs Elastic Agent as an OTel Collector. Since there is no concept of installation in OTel Collector like there is in Elastic Agent, I'm not clear on what the expected behavior of ./elastic-agent install otel should be?

Setting aside the implementation details of service files, etc. for a moment, what is the user-facing behavior we want to achieve?

@strawgate
Copy link
Contributor Author

strawgate commented Jun 13, 2024

As OTel is just a mode of Agent, if a user wants to run the OTel Collector as a service they need to be able to have the service start in OTel mode.

edited the task to separate the problem from my various thoughts on a solution

@strawgate strawgate added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Jun 13, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@ycombinator ycombinator changed the title Add an otel mode to elastic-agent install Run Elastic Agent in otel mode as a service Jun 13, 2024
@ycombinator
Copy link
Contributor

Chatting with @blakerouse today, it seems #5767 might already satisfy the requirements of this issue.

@pchila
Copy link
Member

pchila commented Oct 29, 2024

Looking at #5767 it seems that the agent installation will work also for running EDOT Collector as long as the config file contains an OTel configuration.

Not sure if we need to do something else in this issue, since the only thing necessary to run the collector as a service is a one-time configuration of elastic-agent.yml

@strawgate @ycombinator @cmacknz Any thoughts? Do you think we may need a post-install task to generate an initial OTel collector/ elastic-agent config ?

@strawgate
Copy link
Contributor Author

since the only thing necessary to run the collector as a service is a one-time configuration of elastic-agent.yml

I think this makes sense to keep as a requirement if there's no fleet enrollment.

@cmacknz
Copy link
Member

cmacknz commented Oct 29, 2024

Yes, the upstream collector has no concept of an install command that I can find in the relevant docs, so making use of elastic-agent.yml a requirement of our distro's install seems fine to me.

@pchila
Copy link
Member

pchila commented Oct 30, 2024

since the only thing necessary to run the collector as a service is a one-time configuration of elastic-agent.yml

I think this makes sense to keep as a requirement if there's no fleet enrollment.

@strawgate could you expand on this? What should the requirement be? To have a sample OTel collector config instead of the "traditional" elastic-agent.yml content at the end of the install ?

@strawgate
Copy link
Contributor Author

@strawgate could you expand on this? What should the requirement be?

I was just saying that the current state of this -- requiring a config file to be placed by the user before the service starts working, is fine with me

@pchila
Copy link
Member

pchila commented Oct 30, 2024

I'll keep this open until #5767 is merged and then test the feature to make sure that everything works as expected

@ycombinator
Copy link
Contributor

ycombinator commented Oct 30, 2024

We need a way to inform the user of this requirement or rather, enhancement, that Agent can be installed with an OTel configuration and not just the traditional Agent configuration. Unless @strawgate or @cmacknz have other opinions, @pchila could you work with @kilfoyle to add something about it under https://www.elastic.co/guide/en/fleet/current/elastic-agent-installation.html towards closing out this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

No branches or pull requests

5 participants