// tag::deb[]

:beatname_url: {beats-ref-root}/{beatname_lc}/{branch}

["source","sh",subs="attributes"]
----------------------------------------------------------------------
sudo service {beatname_pkg} start
----------------------------------------------------------------------

// tag::initd-note[]
NOTE: If you use an `init.d` script to start {beatname_uc}, you can't specify command
line flags (see {beatname_url}/command-line-options.html[Command reference]). To specify flags, start {beatname_uc} in
the foreground.

// end::initd-note[]

Also see {beatname_url}/running-with-systemd.html[{beatname_uc} and systemd].
// end::deb[]

// tag::rpm[]
["source","sh",subs="attributes"]
----------------------------------------------------------------------
sudo service {beatname_pkg} start
----------------------------------------------------------------------

include::start.asciidoc[tag=initd-note]

Also see {beatname_url}/running-with-systemd.html[{beatname_uc} and systemd].

// end::rpm[]

// tag::mac[]
ifndef::has_modules_command[]
["source","sh",subs="attributes,callouts"]
----------------------------------------------------------------------
sudo chown root {beatname_lc}.yml <1>
sudo ./{beatname_lc} -e
----------------------------------------------------------------------
<1> You'll be running {beatname_uc} as root, so you need to change ownership
of the configuration file, or run {beatname_uc} with `--strict.perms=false`
specified. See
{beats-ref}/config-file-permissions.html[Config File Ownership and Permissions].
endif::has_modules_command[]
ifdef::has_modules_command[]
["source","sh",subs="attributes,callouts"]
----------------------------------------------------------------------
sudo chown root {beatname_lc}.yml <1>
sudo chown root modules.d/{modulename}.yml <1>
sudo ./{beatname_lc} -e
----------------------------------------------------------------------
<1> You'll be running {beatname_uc} as root, so you need to change ownership of the
configuration file and any configurations enabled in the `modules.d` directory,
or run {beatname_uc} with `--strict.perms=false` specified. See
{beats-ref}/config-file-permissions.html[Config File Ownership and Permissions].
endif::has_modules_command[]
// end::mac[]

// tag::brew[]
To have launchd start +elastic/tap/{beatname_lc}+ and then restart it at login,
run:

["source","sh",subs="attributes"]
-----
brew services start elastic/tap/{beatname_lc}-full
-----

ifndef::requires-sudo[]
To run {beatname_uc} in the foreground instead of running it as a background
service, run:

["source","sh",subs="attributes"]
-----
{beatname_lc} -e
-----
endif::[]

ifdef::requires-sudo[]
To run {beatname_uc} in the foreground instead of running it as a background
service, run:

ifndef::has_modules_command[]
["source","sh",subs="attributes"]
-----
sudo chown root /usr/local/etc/{beatname_lc}/{beatname_lc}.yml <1>
sudo {beatname_lc} -e
-----
<1> You'll be running {beatname_uc} as root, so you need to change ownership
of the configuration file, or run {beatname_uc} with `--strict.perms=false`
specified. See
{beats-ref}/config-file-permissions.html[Config File Ownership and Permissions].
endif::has_modules_command[]

ifdef::has_modules_command[]
["source","sh",subs="attributes,callouts"]
----------------------------------------------------------------------
sudo chown root /usr/local/etc/{beatname_lc}/{beatname_lc}.yml <1>
sudo chown root /usr/local/etc/{beatname_lc}/modules.d/{modulename}.yml <1>
sudo {beatname_lc} -e
----------------------------------------------------------------------
<1> You'll be running {beatname_uc} as root, so you need to change ownership of the
configuration file and any configurations enabled in the `modules.d` directory,
or run {beatname_uc} with `--strict.perms=false` specified. See
{beats-ref}/config-file-permissions.html[Config File Ownership and Permissions].

endif::has_modules_command[]

endif::requires-sudo[]
// end::brew[]

// tag::linux[]

ifndef::has_modules_command[]
["source","sh",subs="attributes,callouts"]
----------------------------------------------------------------------
sudo chown root {beatname_lc}.yml <1>
sudo ./{beatname_lc} -e
----------------------------------------------------------------------
<1> You'll be running {beatname_uc} as root, so you need to change ownership
of the configuration file, or run {beatname_uc} with `--strict.perms=false`
specified. See
{beats-ref}/config-file-permissions.html[Config File Ownership and Permissions].
endif::has_modules_command[]
ifdef::has_modules_command[]
["source","sh",subs="attributes,callouts"]
----------------------------------------------------------------------
sudo chown root {beatname_lc}.yml <1>
sudo chown root modules.d/{modulename}.yml <1>
sudo ./{beatname_lc} -e
----------------------------------------------------------------------
<1> You'll be running {beatname_uc} as root, so you need to change ownership of the
configuration file and any configurations enabled in the `modules.d` directory,
or run {beatname_uc} with `--strict.perms=false` specified. See
{beats-ref}/config-file-permissions.html[Config File Ownership and Permissions].
endif::has_modules_command[]

// end::linux[]

// tag::win[]
["source","sh",subs="attributes"]
----------------------------------------------------------------------
PS C:{backslash}Program Files{backslash}{beatname_lc}> Start-Service {beatname_lc}
----------------------------------------------------------------------

By default, Windows log files are stored in +C:{backslash}ProgramData{backslash}{beatname_lc}\Logs+.

ifeval::["{beatname_lc}"=="metricbeat"]
NOTE: On Windows, statistics about system load and swap usage are currently
not captured
endif::[]

// end::win[]
