# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 	http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
---
- name: host
  title: Host
  group: 2
  short: Fields describing the relevant computing instance.
  description: >
    A host is defined as a general computing instance.

    ECS host.* fields should be populated with details about the host on which
    the event happened, or from which the measurement was taken.
    Host types include hardware, virtual machines, Docker containers, and Kubernetes nodes.
  type: group
  fields:

    - name: hostname
      level: core
      type: keyword
      short: Hostname of the host.
      description: >
        Hostname of the host.

        It normally contains what the `hostname` command returns on the host machine.

    - name: name
      level: core
      type: keyword
      short: Name of the host.
      description: >
        Name of the host.

        It can contain what `hostname` returns on Unix systems, the fully
        qualified domain name, or a name specified by the user. The sender
        decides which value to use.

    - name: id
      level: core
      type: keyword
      short: Unique host id.
      description: >
        Unique host id.

        As hostname is not always unique, use values that are meaningful
        in your environment.

        Example: The current usage of `beat.name`.

    - name: ip
      level: core
      type: ip
      description: >
        Host ip addresses.
      normalize:
        - array

    - name: mac
      level: core
      type: keyword
      short: Host MAC addresses.
      pattern: ^[A-F0-9]{2}(-[A-F0-9]{2}){5,}$
      example: '["00-00-5E-00-53-23", "00-00-5E-00-53-24"]'
      description: >
        Host MAC addresses.

        The notation format from RFC 7042 is suggested: Each octet (that is, 8-bit byte) is
        represented by two [uppercase] hexadecimal digits giving the value of
        the octet as an unsigned integer. Successive octets are separated by a
        hyphen.
      normalize:
        - array

    - name: type
      level: core
      type: keyword
      short: Type of host.
      description: >
        Type of host.

        For Cloud providers this can be the machine type like `t2.medium`.
        If vm, this could be the container, for example, or other information
        meaningful in your environment.

    - name: uptime
      level: extended
      type: long
      example: 1325
      description: >
        Seconds the host has been up.

    - name: architecture
      level: core
      type: keyword
      example: "x86_64"
      description: >
        Operating system architecture.

    - name: domain
      level: extended
      type: keyword
      short: Name of the directory the group is a member of.
      description: >
        Name of the domain of which the host is a member.

        For example, on Windows this could be the host's Active Directory domain or NetBIOS domain name.
        For Linux this could be the domain of the host's LDAP provider.
      example: CONTOSO

    - name: cpu.usage
      level: extended
      type: scaled_float
      scaling_factor: 1000
      short: Percent CPU used, between 0 and 1.
      description: >
        Percent CPU used which is normalized by the number of CPU cores and it
        ranges from 0 to 1.

        Scaling factor: 1000.

        For example: For a two core host, this value should be the average of
        the two cores, between 0 and 1.

    - name: disk.read.bytes
      type: long
      level: extended
      short: The number of bytes read by all disks.
      description: >
        The total number of bytes (gauge) read successfully (aggregated from all
        disks) since the last metric collection.

    - name: disk.write.bytes
      type: long
      level: extended
      short: The number of bytes written on all disks.
      description: >
        The total number of bytes (gauge) written successfully (aggregated from
        all disks) since the last metric collection.

    - name: network.ingress.bytes
      type: long
      level: extended
      short: The number of bytes received on all network interfaces.
      description: >
        The number of bytes received (gauge) on all network interfaces by the
        host since the last metric collection.

    - name: network.ingress.packets
      type: long
      level: extended
      short: The number of packets received on all network interfaces.
      description: >
        The number of packets (gauge) received on all network interfaces by the
        host since the last metric collection.

    - name: network.egress.bytes
      type: long
      level: extended
      short: The number of bytes sent on all network interfaces.
      description: >
        The number of bytes (gauge) sent out on all network interfaces by the
        host since the last metric collection.

    - name: network.egress.packets
      type: long
      level: extended
      short: The number of packets sent on all network interfaces.
      description: >
        The number of packets (gauge) sent out on all network interfaces by the
        host since the last metric collection.

    - name: boot.id
      level: extended
      type: keyword
      short: Linux boot uuid taken from /proc/sys/kernel/random/boot_id
      example: 88a1f0ed-5ae5-41ee-af6b-41921c311872
      beta: This field is beta and subject to change.
      description: >
        Linux boot uuid taken from /proc/sys/kernel/random/boot_id. Note the boot_id value from /proc may or may not be the same in containers as on the host. Some container runtimes will bind mount a new boot_id value onto the proc file in each container.

    - name: pid_ns_ino
      level: extended
      type: keyword
      short: Pid namespace inode
      example: 256383
      beta: This field is beta and subject to change.
      description: >
        This is the inode number of the namespace in the namespace file system (nsfs). Unsigned int inum in include/linux/ns_common.h.
