On Amazon Linux 2 on ec2 instance I editted the elastic-agent service and I get an error "Invalid number of arguments"
[ec2-user@ip-172-31-21-92 ~]$ sudo systemctl daemon-reload elastic-agent
Invalid number of arguments.
I have edited my service file to look like this:
[Unit]
Description=Agent manages other beats based on configuration provided.
Documentation=https://www.elastic.co/products/beats/elastic-agent
Wants=network-online.target
After=network-online.target
[Service]
Environment="BEAT_LOG_OPTS="
Environment="BEAT_CONFIG_OPTS=-c /etc/elastic-agent/elastic-agent.yml"
Environment="BEAT_PATH_OPTS=--path.home /usr/share/elastic-agent --path.config /etc/elastic-agent --path.data /var/lib/elastic-agent --path.logs /var/log/elastic-agent"
ExecStart=/usr/share/elastic-agent/bin/elastic-agent --environment systemd $BEAT_LOG_OPTS $BEAT_CONFIG_OPTS $BEAT_PATH_OPTS -v
Restart=always
[Install]
WantedBy=multi-user.target
The only edit I made to the installed file was to add the "-v" flag to the end of ExecStart
No need to add
elastic-agent
, just run