### Download Example Packetbeat Configuration Source: https://www.elastic.co/guide/en/beats/packetbeat/current/running-on-docker.html Download a starting point for your Packetbeat configuration file using this curl command. ```bash curl -L -O https://raw.githubusercontent.com/elastic/beats/9.3/deploy/docker/packetbeat.docker.yml ``` -------------------------------- ### Configure Kibana protocol and path Source: https://www.elastic.co/guide/en/beats/packetbeat/current/setup-kibana-endpoint.html Example showing how to specify the protocol and an HTTP path prefix for reverse proxy setups. ```yaml setup.kibana.host: "192.0.2.255:5601" setup.kibana.protocol: "http" setup.kibana.path: /kibana ``` -------------------------------- ### Start Packetbeat Service Source: https://www.elastic.co/guide/en/beats/packetbeat/current/running-with-systemd.html Use this command to start the Packetbeat service. ```bash sudo systemctl start packetbeat ``` -------------------------------- ### Enable Packetbeat Auto Start Source: https://www.elastic.co/guide/en/beats/packetbeat/current/running-with-systemd.html Enable Packetbeat to start automatically when the system boots. ```bash sudo systemctl enable packetbeat ``` -------------------------------- ### Download and install Packetbeat on Debian/Ubuntu Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Downloads the Packetbeat .deb package and installs it using dpkg. ```bash curl -L -O https://artifacts.elastic.co/downloads/beats/packetbeat/packetbeat-9.3.3-amd64.deb sudo dpkg -i packetbeat-9.3.3-amd64.deb ``` -------------------------------- ### Install libpcap on Debian/Ubuntu Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Installs the libpcap packet capture library on Debian-based systems using apt-get. ```bash sudo apt-get install libpcap0.8 ``` -------------------------------- ### Download and install Packetbeat on RPM-based systems Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Downloads the Packetbeat .rpm package and installs it using rpm. ```bash curl -L -O https://artifacts.elastic.co/downloads/beats/packetbeat/packetbeat-9.3.3-x86_64.rpm sudo rpm -vi packetbeat-9.3.3-x86_64.rpm ``` -------------------------------- ### Setup Packetbeat Assets Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Load predefined assets for parsing, indexing, and visualizing data by running the `packetbeat setup -e` command. This requires a connection to Elasticsearch or Elastic Cloud. ```bash packetbeat setup -e ``` ```powershell PS > .\packetbeat.exe setup -e ``` -------------------------------- ### Start Packetbeat on MacOS and Linux Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Change ownership of the configuration file to root before starting Packetbeat in the foreground. ```bash sudo chown root packetbeat.yml sudo ./packetbeat -e ``` -------------------------------- ### Example event with added tags Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-tags.html This is an example of an event after the add_tags processor has been applied, showing the 'environment' field populated with the specified tags. ```json { "environment": ["web", "production"] } ``` -------------------------------- ### Start Packetbeat Service on Windows Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Use PowerShell to start the Packetbeat service on Windows systems. ```powershell PS C:\Program Files\packetbeat> Start-Service packetbeat ``` -------------------------------- ### Advanced host and protocol configuration Source: https://www.elastic.co/guide/en/beats/packetbeat/current/elasticsearch-output.html Example of defining multiple hosts with specific protocol and path settings. ```yaml output.elasticsearch: hosts: ["10.45.3.2:9220", "10.45.3.1:9230"] protocol: https path: /elasticsearch ``` -------------------------------- ### Add Elastic APT Repository Source: https://www.elastic.co/guide/en/beats/packetbeat/current/setup-repositories.html Installs the Elastic signing key and adds the repository definition for APT-based systems. Ensure apt-transport-https is installed if needed. ```bash wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - ``` ```bash sudo apt-get install apt-transport-https ``` ```bash echo "deb https://artifacts.elastic.co/packages/9.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-9.x.list ``` ```bash echo "deb https://artifacts.elastic.co/packages/oss-9.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-9.x.list ``` ```bash sudo apt-get update && sudo apt-get install packetbeat ``` -------------------------------- ### Run Packetbeat Setup Command Source: https://www.elastic.co/guide/en/beats/packetbeat/current/running-on-docker.html Execute this command to set up the index pattern and load visualizations, dashboards, and ML jobs. Substitute your Kibana and Elasticsearch hosts and ports as needed. ```bash docker run --rm \ --cap-add=NET_ADMIN \ docker.elastic.co/beats/packetbeat:9.3.3 \ setup -E setup.kibana.host=kibana:5601 \ -E output.elasticsearch.hosts=["elasticsearch:9200"] ``` -------------------------------- ### Install libpcap on RPM-based systems Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Installs the libpcap packet capture library on RPM-based systems using yum. ```bash sudo yum install libpcap ``` -------------------------------- ### Define initial event structure Source: https://www.elastic.co/guide/en/beats/packetbeat/current/move-fields.html Example input event structure before applying the move_fields processor. ```json { "app": { "method": "a", "elapsed_time": 100, "user_id": 100, "message": "i'm a message" } } ``` -------------------------------- ### Start Packetbeat Service on DEB and RPM Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Use the service manager to start Packetbeat on DEB or RPM based Linux distributions. ```bash sudo service packetbeat start ``` -------------------------------- ### Example Syslog Message Source: https://www.elastic.co/guide/en/beats/packetbeat/current/syslog.html An example of an RFC 5424 formatted syslog message that can be processed. ```json { "message": "<165>1 2022-01-11T22:14:15.003Z mymachine.example.com eventslog 1024 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"] this is the message" } ``` -------------------------------- ### Filtered DNS Event Example Source: https://www.elastic.co/guide/en/beats/packetbeat/current/filtering-and-enhancing-data.html An example of a DNS event after applying the `include_fields` processor, showing only the specified fields. ```json { "@timestamp": "2019-01-19T03:41:11.798Z", "client": { "bytes": 28, "ip": "10.100.6.82" }, "server": { "bytes": 271, "ip": "10.100.4.1" }, "dns": { "question": { "name": "www.elastic.co", "etld_plus_one": "elastic.co" }, "response_code": "NOERROR" }, "type": "dns" } ``` -------------------------------- ### Authentication methods for Elasticsearch output Source: https://www.elastic.co/guide/en/beats/packetbeat/current/elasticsearch-output.html Configuration examples for different authentication mechanisms when connecting to a secured cluster. ```yaml output.elasticsearch: hosts: ["https://myEShost:9200"] username: "packetbeat_writer" password: "YOUR_PASSWORD" ``` ```yaml output.elasticsearch: hosts: ["https://myEShost:9200"] api_key: "ZCV7VnwBgnX0T19fN8Qe:KnR6yE41RrSowb0kQ0HWoA" ``` ```yaml output.elasticsearch: hosts: ["https://myEShost:9200"] ssl.certificate: "/etc/pki/client/cert.pem" ssl.key: "/etc/pki/client/cert.key" ``` -------------------------------- ### Configure Kafka output in packetbeat.yml Source: https://www.elastic.co/guide/en/beats/packetbeat/current/kafka-output.html Example configuration for the Kafka output, including host definitions, topic selection, and message settings. ```yaml output.kafka: # initial brokers for reading cluster metadata hosts: ["kafka1:9092", "kafka2:9092", "kafka3:9092"] # message topic selection + partitioning topic: '%{[fields.log_topic]}' partition.round_robin: reachable_only: false required_acks: 1 compression: gzip max_message_bytes: 1000000 ``` -------------------------------- ### Run Packetbeat with Volume-Mounted Configuration Source: https://www.elastic.co/guide/en/beats/packetbeat/current/running-on-docker.html Configure Packetbeat by mounting a configuration file via a volume. This example shows how to specify the volume mount with `docker run`. ```bash docker run -d \ --name=packetbeat \ --user=packetbeat \ --volume="$(pwd)/packetbeat.docker.yml:/usr/share/packetbeat/packetbeat.yml:ro" \ --cap-add="NET_RAW" \ --cap-add="NET_ADMIN" \ --network=host \ docker.elastic.co/beats/packetbeat:9.3.3 \ --strict.perms=false -e \ -E output.elasticsearch.hosts=["elasticsearch:9200"] ``` -------------------------------- ### Example Packetbeat Metrics Log Line Source: https://www.elastic.co/guide/en/beats/packetbeat/current/configuration-logging.html An example of a log line showing non-zero internal metrics for Packetbeat. This output is enabled by default and can be configured via `logging.metrics.enabled`, `logging.metrics.period`, and `logging.metrics.namespaces`. ```log 2017-12-17T19:17:42.667-0500 INFO [metrics] log/log.go:110 Non-zero metrics in the last 30s: beat.info.uptime.ms=30004 beat.memstats.gc_next=5046416 ``` -------------------------------- ### Example Syslog Processor Metrics JSON Source: https://www.elastic.co/guide/en/beats/packetbeat/current/syslog.html Sample output from the metrics endpoint for a processor with a tag of 'log-input' and an instance ID of '1'. ```json { "processor": { "syslog": { "log-input-1": { "failure": 10, "missing": 0, "success": 3 } } } } ``` -------------------------------- ### Install Packetbeat as a Windows service Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Installs Packetbeat as a Windows service using a PowerShell script. Ensure you run PowerShell as an Administrator. ```powershell PS > cd 'C:\Program Files\Packetbeat' PS C:\Program Files\Packetbeat> .\install-service-packetbeat.ps1 ``` -------------------------------- ### Example Packetbeat Output Configuration with Kerberos Password Authentication Source: https://www.elastic.co/guide/en/beats/packetbeat/current/configuration-kerberos.html Use this configuration to enable Kerberos authentication using a password for your Packetbeat output. Ensure you replace placeholder values with your actual credentials and paths. ```yaml output.elasticsearch.hosts: ["http://my-elasticsearch.elastic.co:9200"] output.elasticsearch.kerberos.auth_type: password output.elasticsearch.kerberos.username: "elastic" output.elasticsearch.kerberos.password: "changeme" output.elasticsearch.kerberos.config_path: "/etc/krb5.conf" output.elasticsearch.kerberos.realm: "ELASTIC.CO" ``` -------------------------------- ### Example Packetbeat Stats Output Source: https://www.elastic.co/guide/en/beats/packetbeat/current/http-endpoint.html This is an example of the JSON output you can expect when querying the /stats endpoint. The actual output may vary based on your Packetbeat configuration and the metrics collected. ```json { "beat": { "cpu": { "system": { "ticks": 1710, "time": { "ms": 1712 } }, "total": { "ticks": 3420, "time": { "ms": 3424 }, "value": 3420 }, "user": { "ticks": 1710, "time": { "ms": 1712 } } }, "info": { "ephemeral_id": "ab4287c4-d907-4d9d-b074-d8c3cec4a577", "uptime": { "ms": 195547 } }, "memstats": { "gc_next": 17855152, "memory_alloc": 9433384, "memory_total": 492478864, "rss": 50405376 }, "runtime": { "goroutines": 22 } }, "libbeat": { "config": { "module": { "running": 0, "starts": 0, "stops": 0 }, "scans": 1, "reloads": 1 }, "output": { "events": { "acked": 0, "active": 0, "batches": 0, "dropped": 0, "duplicates": 0, "failed": 0, "total": 0 }, "read": { "bytes": 0, "errors": 0 }, "type": "elasticsearch", "write": { "bytes": 0, "errors": 0 } }, "pipeline": { "clients": 6, "events": { "active": 716, "dropped": 0, "failed": 0, "filtered": 0, "published": 716, "retry": 278, "total": 716 }, "queue": { "acked": 0 } } }, "system": { "cpu": { "cores": 4 }, "load": { "1": 2.22, "15": 1.8, "5": 1.74, "norm": { "1": 0.555, "15": 0.45, "5": 0.435 } } } } ``` -------------------------------- ### Define prefixing input event Source: https://www.elastic.co/guide/en/beats/packetbeat/current/move-fields.html Example input event structure for demonstrating field prefixing. ```json { "app": { "method": "a"}, "cost": 100 } ``` -------------------------------- ### List Available Network Devices Source: https://www.elastic.co/guide/en/beats/packetbeat/current/configuration-interfaces.html Run this command to get a list of available network devices for sniffing. This is useful for selecting a device by its index. ```bash packetbeat devices ``` -------------------------------- ### Load balancing configuration Source: https://www.elastic.co/guide/en/beats/packetbeat/current/elasticsearch-output.html Example of enabling load balancing across multiple Elasticsearch nodes. ```yaml output.elasticsearch: hosts: ["localhost:9200", "localhost:9201"] loadbalance: true ``` -------------------------------- ### Example Event with Host Metadata Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-host-metadata.html This JSON structure shows the fields added to an event by the add_host_metadata processor, including host IP, MAC, OS details, and geographical information. ```json { "host":{ "architecture":"x86_64", "name":"example-host", "id":"", "os":{ "family":"darwin", "type":"macos", "build":"16G1212", "platform":"darwin", "version":"10.12.6", "kernel":"16.7.0", "name":"Mac OS X" }, "ip": ["192.168.0.1", "10.0.0.1"], "mac": ["00:25:96:12:34:56", "72:00:06:ff:79:f1"], "geo": { "continent_name": "North America", "country_iso_code": "US", "region_name": "New York", "region_iso_code": "NY", "city_name": "New York", "name": "nyc-dc1-rack1", "location": "40.7128, -74.0060" } } } ``` -------------------------------- ### Configure Kafka Output with Headers Source: https://www.elastic.co/guide/en/beats/packetbeat/current/kafka-output.html Example of configuring Kafka output with custom headers. Headers are key-value pairs that will be included in each Kafka message. ```yaml output.kafka: hosts: ["localhost:9092"] topic: "logs-%{[agent.version]}" headers: - key: "some-key" value: "some value" - key: "another-key" value: "another value" ``` -------------------------------- ### Packetbeat Kibana setup with username and password Source: https://www.elastic.co/guide/en/beats/packetbeat/current/securing-communication-elasticsearch.html Configure Packetbeat to authenticate with Kibana using a username and password for setup tasks like creating dashboards. Ensure the user has the necessary privileges. Sensitive passwords should be stored securely. ```yaml setup.kibana: host: "mykibanahost:5601" username: "packetbeat_kib_setup" password: "YOUR_PASSWORD" ``` -------------------------------- ### Configure translate_ldap_attribute processor Source: https://www.elastic.co/guide/en/beats/packetbeat/current/processor-translate-guid.html Example configuration for the translate_ldap_attribute processor, showing how to specify the source field and optional LDAP connection parameters. ```yaml processors: - translate_ldap_attribute: field: winlog.event_data.ObjectGuid ignore_missing: true ignore_failure: true # ldap_domain: "example.com" # Optional - override the OS-discovered domain used for SRV/LOGONSERVER hints # ldap_address: "ldap://ds.example.com:389" # ldap_base_dn: "dc=example,dc=com" ``` -------------------------------- ### Configure specific cloud providers Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-cloud-metadata.html Example configuration to restrict metadata retrieval to a specific provider, such as AWS. ```yaml processors: - add_cloud_metadata: providers: aws ``` -------------------------------- ### Test Packetbeat Configuration Source: https://www.elastic.co/guide/en/beats/packetbeat/current/yaml-tips.html Verify the validity of your Packetbeat configuration file by running this command in the installation directory. It will report any structural errors found in the YAML file. ```bash packetbeat test config -c packetbeat.yml ``` -------------------------------- ### Run Packetbeat from Archive Installation Source: https://www.elastic.co/guide/en/beats/packetbeat/current/directory-layout.html When using zip, tar.gz, or tgz distributions, Packetbeat automatically sets paths based on the location of the extracted binary. Simply run the executable from its directory. ```bash ./packetbeat ``` -------------------------------- ### Enable Promiscuous Mode on Network Interface Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-mirror-ports.html Run this command to set the network interface to promiscuous mode. Replace `` with your actual network device name. For example, `ip link set enp5s0f1 promisc on`. ```bash ip link set promisc on ``` -------------------------------- ### Example observer metadata output Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-observer-metadata.html This JSON shows the structure of metadata added to events by the add_observer_metadata processor, including observer hostname, type, vendor, IP, MAC, and geo-location. ```json { "observer" : { "hostname" : "avce", "type" : "heartbeat", "vendor" : "elastic", "ip" : [ "192.168.1.251", "fe80::64b2:c3ff:fe5b:b974", ], "mac" : [ "dc:c1:02:6f:1b:ed", ], "geo": { "continent_name": "North America", "country_iso_code": "US", "region_name": "New York", "region_iso_code": "NY", "city_name": "New York", "name": "nyc-dc1-rack1", "location": "40.7128, -74.0060" } } } ``` -------------------------------- ### Set Packetbeat Project Paths Source: https://www.elastic.co/guide/en/beats/packetbeat/current/configuration-path.html Configure the main project paths for Packetbeat. These paths define the base directory for installation, configuration files, data storage, and log files. ```yaml path.home: /usr/share/beat path.config: /etc/beat path.data: /var/lib/beat path.logs: /var/log/ ``` -------------------------------- ### Example Indexed TLS Event Data Source: https://www.elastic.co/guide/en/beats/packetbeat/current/configuration-tls.html This JSON structure represents the data captured by Packetbeat for a TLS connection, including client and server details, certificate information, and negotiated parameters. No specific setup is required beyond Packetbeat's TLS module being enabled. ```json { "tls": { "client": { "supported_ciphers": [ "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_3DES_EDE_CBC_SHA", "TLS_EMPTY_RENEGOTIATION_INFO_SCSV" ], "ja3": "e6573e91e6eb777c0933c5b8f97f10cd", "server_name": "example.net" }, "server": { "subject": "CN=www.example.org,OU=Technology,O=Internet Corporation for Assigned Names and Numbers,L=Los Angeles,ST=California,C=US", "issuer": "CN=DigiCert SHA2 Secure Server CA,O=DigiCert Inc,C=US", "not_before": "2018-11-28T00:00:00.000Z", "not_after": "2020-12-02T12:00:00.000Z", "hash": { "sha1": "7BB698386970363D2919CC5772846984FFD4A889" } }, "version": "1.2", "version_protocol": "tls", "cipher": "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "established": true, "next_protocol": "h2", "detailed": { "server_certificate": { "subject": { "common_name": "www.example.org", "country": "US", "organization": "Internet Corporation for Assigned Names and Numbers", "organizational_unit": "Technology", "locality": "Los Angeles", "province": "California" }, "not_after": "2020-12-02T12:00:00.000Z", "public_key_size": 2048, "alternative_names": [ "www.example.org", "example.com", "example.edu", "example.net", "example.org", "www.example.com", "www.example.edu", "www.example.net" ], "signature_algorithm": "SHA256-RSA", "version": 3, "issuer": { "organization": "DigiCert Inc", "common_name": "DigiCert SHA2 Secure Server CA", "country": "US" }, "not_before": "2018-11-28T00:00:00.000Z", "public_key_algorithm": "RSA", "serial_number": "21020869104500376438182461249190639870" }, "server_certificate_chain": [ { "public_key_algorithm": "RSA", "not_before": "2013-03-08T12:00:00.000Z", "not_after": "2023-03-08T12:00:00.000Z", "version": 3, "serial_number": "2646203786665923649276728595390119057", "issuer": { "organizational_unit": "www.digicert.com", "common_name": "DigiCert Global Root CA", "country": "US", "organization": "DigiCert Inc" }, "subject": { "country": "US", "organization": "DigiCert Inc", "common_name": "DigiCert SHA2 Secure Server CA" }, "public_key_size": 2048, "signature_algorithm": "SHA256-RSA" }, { "public_key_algorithm": "RSA", "subject": { "common_name": "DigiCert Global Root CA", "country": "US", "organization": "DigiCert Inc", "organizational_unit": "www.digicert.com" }, "issuer": { "country": "US", "organization": "DigiCert Inc", "organizational_unit": "www.digicert.com", "common_name": "DigiCert Global Root CA" }, "signature_algorithm": "SHA1-RSA", "serial_number": "10944719598952040374951832963794454346", "not_before": "2006-11-10T00:00:00.000Z", "not_after": "2031-11-10T00:00:00.000Z", "public_key_size": 2048, "version": 3 } ], "client_certificate_requested": false, "version": "TLS 1.2", "client_hello": { "version": "3.3", "supported_compression_methods": [ "NULL" ], "extensions": { "ec_points_formats": [ "uncompressed" ], "supported_groups": [ "x25519", "secp256r1", "secp384r1" ], "signature_algorithms": [ "rsa_pkcs1_sha512", "ecdsa_secp521r1_sha512", "(unknown:0xefef)" ] } } } } } ``` -------------------------------- ### Enable beat-xpack module Source: https://www.elastic.co/guide/en/beats/packetbeat/current/monitoring-metricbeat-collection.html Run this command to enable the beat-xpack module in the Metricbeat modules directory. ```bash metricbeat modules enable beat-xpack ``` -------------------------------- ### Prevent Npcap installation on Windows Source: https://www.elastic.co/guide/en/beats/packetbeat/current/configuration-interfaces.html Use this option to prevent Packetbeat from automatically installing the bundled Npcap library on Windows if you prefer to manage your own installation. ```yaml packetbeat.npcap.never_install: true ``` -------------------------------- ### Disable Packetbeat Auto Start Source: https://www.elastic.co/guide/en/beats/packetbeat/current/running-with-systemd.html Disable Packetbeat from starting automatically when the system boots. ```bash sudo systemctl disable packetbeat ``` -------------------------------- ### Example XML Wineventlog Data Source: https://www.elastic.co/guide/en/beats/packetbeat/current/decode-xml-wineventlog.html This is an example of the XML data that the decode_xml_wineventlog processor can parse. It represents a Windows security audit event. ```json { "event": { "original": "4672001254800x802000000000000011303SecurityvagrantS-1-5-18SYSTEMNT AUTHORITY0x3e7SeAssignPrimaryTokenPrivilege\n\t\t\tSeTcbPrivilege\n\t\t\tSeSecurityPrivilege\n\t\t\tSeTakeOwnershipPrivilege\n\t\t\tSeLoadDriverPrivilege\n\t\t\tSeBackupPrivilege\n\t\t\tSeRestorePrivilege\n\t\t\tSeDebugPrivilege\n\t\t\tSeAuditPrivilege\n\t\t\tSeSystemEnvironmentPrivilege\n\t\t\tSeImpersonatePrivilege\n\t\t\tSeDelegateSessionUserImpersonatePrivilegeSpecial privileges assigned to new logon.\n\nSubject:\n\tSecurity ID:\t\tS-1-5-18\n\tAccount Name:\t\tSYSTEM\n\tAccount Domain:\t\tNT AUTHORITY\n\tLogon ID:\t\t0x3E7\n\nPrivileges:\t\tSeAssignPrimaryTokenPrivilege\n\t\t\tSeTcbPrivilege\n\t\t\tSeSecurityPrivilege\n\t\t\tSeTakeOwnershipPrivilege\n\t\t\tSeLoadDriverPrivilege\n\t\t\tSeBackupPrivilege\n\t\t\tSeRestorePrivilege\n\t\t\tSeDebugPrivilege\n\t\t\tSeAuditPrivilege\n\t\t\tSeSystemEnvironmentPrivilege\n\t\t\tSeImpersonatePrivilege\n\t\t\tSeDelegateSessionUserImpersonatePrivilegeInformationSpecial LogonInfoSecurityMicrosoft Windows security auditing.Audit Success ``` -------------------------------- ### Run Packetbeat Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-geoip.html Execute Packetbeat from the command line with the '-e' flag to enable logging to standard output. Use 'sudo' if the configuration file requires root privileges. ```bash ./packetbeat -e ``` -------------------------------- ### Configure beat-xpack module settings Source: https://www.elastic.co/guide/en/beats/packetbeat/current/monitoring-metricbeat-collection.html The configuration file for the beat-xpack module defines the metrics to collect and the host endpoint. ```yaml - module: beat metricsets: - stats - state period: 10s hosts: ["http://localhost:5066"] #username: "user" #password: "secret" xpack.enabled: true ``` -------------------------------- ### Decode XML with error and missing field handling Source: https://www.elastic.co/guide/en/beats/packetbeat/current/decode-xml.html Decodes XML from the 'example' field into the 'xml' field, ignoring errors and skipping processing if the 'example' field is missing. ```yaml processors: - decode_xml: field: example target_field: xml ignore_missing: true ignore_failure: true ``` -------------------------------- ### Disable ILM setup check in Packetbeat config Source: https://www.elastic.co/guide/en/beats/packetbeat/current/privileges-to-publish-events.html When using ILM, disable the ILM setup check in the Packetbeat configuration file before running Packetbeat to publish events. This prevents potential conflicts with ILM policies. ```yaml setup.ilm.check_exists: false ``` -------------------------------- ### Configure Kubernetes Client Options Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-kubernetes-metadata.html Specify custom QPS and burst values for the Kubernetes client. If not set, the Kubernetes client's default QPS and burst values will be used. ```yaml kube_client_options: qps: 5 burst: 10 ``` -------------------------------- ### Load Packetbeat Dashboards (MacOS/Linux) Source: https://www.elastic.co/guide/en/beats/packetbeat/current/load-kibana-dashboards.html Execute this command to load the Packetbeat index template and sample dashboards into Kibana on MacOS and Linux systems. Kibana must be running and accessible. ```bash ./packetbeat setup --dashboards ``` -------------------------------- ### Process metadata fields Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-process-metadata.html Example of fields added to an event by the add_process_metadata processor. ```json { "container": { "id": "b5285682fba7449c86452b89a800609440ecc88a7ba5f2d38bedfb85409b30b1" }, "process": { "args": [ "/usr/lib/systemd/systemd", "--switched-root", "--system", "--deserialize", "22" ], "executable": "/usr/lib/systemd/systemd", "name": "systemd", "owner": { "id": "0", "name": "root" }, "parent": { "pid": 0 }, "pid": 1, "start_time": "2018-08-22T08:44:50.684Z", "title": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22" } } ``` -------------------------------- ### Basic environment variable reference Source: https://www.elastic.co/guide/en/beats/packetbeat/current/using-environ-vars.html Use this to reference a simple environment variable in your configuration. The variable is replaced at startup. ```yaml name: ${NAME} ``` -------------------------------- ### Test Packetbeat Configuration Source: https://www.elastic.co/guide/en/beats/packetbeat/current/packetbeat-installation-configuration.html Test your Packetbeat configuration file by running Packetbeat in the foreground with `sudo ./packetbeat test config -e`. Ensure config files are in the expected path or use the `-c` flag. ```bash sudo ./packetbeat test config -e ``` -------------------------------- ### Check Packetbeat Service Status Source: https://www.elastic.co/guide/en/beats/packetbeat/current/running-with-systemd.html Use this command to get the current status of the Packetbeat service. ```bash systemctl status packetbeat ``` -------------------------------- ### Configure Registered Domain Processor Source: https://www.elastic.co/guide/en/beats/packetbeat/current/processor-registered-domain.html Example configuration for the registered_domain processor within the Packetbeat processors block. ```yaml processors: - registered_domain: field: dns.question.name target_field: dns.question.registered_domain target_etld_field: dns.question.top_level_domain target_subdomain_field: dns.question.sudomain ignore_missing: true ignore_failure: true ``` -------------------------------- ### Load Packetbeat Dashboards (Windows PowerShell) Source: https://www.elastic.co/guide/en/beats/packetbeat/current/load-kibana-dashboards.html Open a PowerShell prompt as Administrator and navigate to the Packetbeat directory. Run this command to load the index template and sample dashboards into Kibana. Kibana must be running and accessible. ```powershell PS > .\packetbeat.exe setup --dashboards ``` -------------------------------- ### Enable add_cloud_metadata processor Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-cloud-metadata.html Basic configuration to enable the add_cloud_metadata processor. ```yaml processors: - add_cloud_metadata: ~ ``` -------------------------------- ### Event with added labels Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-labels.html This JSON shows how an event is structured after the add_labels processor has been applied with the example configuration. ```json { "labels": { "number": 1, "with.dots": "test", "nested.with.dots": "nested", "array.0": "do", "array.1": "re", "array.2.with.field": "mi" } } ``` -------------------------------- ### Load Packetbeat Dashboards (DEB/RPM) Source: https://www.elastic.co/guide/en/beats/packetbeat/current/load-kibana-dashboards.html Use this command to load the Packetbeat index template and sample dashboards into Kibana on Debian/RPM based systems. Ensure Kibana is running and accessible. ```bash packetbeat setup --dashboards ``` -------------------------------- ### Processed Syslog Output Source: https://www.elastic.co/guide/en/beats/packetbeat/current/syslog.html The output generated after the syslog processor parses the example message. Note the structured data and timestamp extraction. ```json { "@timestamp": "2022-01-11T22:14:15.003Z", "log": { "syslog": { "priority": 165, "facility": { "code": 20, "name": "local4" }, "severity": { "code": 5, "name": "Notice" }, "hostname": "mymachine.example.com", "appname": "eventslog", "procid": "1024", "msgid": "ID47", "version": 1, "structured_data": { "exampleSDID@32473": { "iut": "3", "eventSource": "Application", "eventID": "1011" }, "examplePriority@32473": { "class": "high" } } } }, "message": "this is the message" } ``` -------------------------------- ### Load Packetbeat Dashboards (Docker) Source: https://www.elastic.co/guide/en/beats/packetbeat/current/load-kibana-dashboards.html Run this Docker command to load the Packetbeat index template and sample dashboards into Kibana. Ensure Kibana is running and accessible. This command uses the host network. ```bash docker run --rm --net="host" docker.elastic.co/beats/packetbeat:9.3.3 setup --dashboards ``` -------------------------------- ### Example of added fields in an event Source: https://www.elastic.co/guide/en/beats/packetbeat/current/add-fields.html This JSON structure demonstrates how fields are added to an event when using the 'add_fields' processor with a 'target' sub-dictionary. ```json { "project": { "name": "myproject", "id": "574734885120952459" } } ``` -------------------------------- ### GET /stats Source: https://www.elastic.co/guide/en/beats/packetbeat/current/http-endpoint.html The /stats endpoint reports internal metrics about the Packetbeat agent. It can be used to monitor the agent's performance and health. ```APIDOC ## GET /stats ### Description Reports internal metrics about the Packetbeat agent. ### Method GET ### Endpoint `/stats` ### Query Parameters - **pretty** (string) - Optional - If set, the output will be pretty-printed. ### Request Example ```bash curl -XGET 'localhost:5066/stats?pretty' ``` ### Response #### Success Response (200) - **beat** (object) - Contains metrics related to the Beat agent itself, including CPU, memory, and runtime information. - **libbeat** (object) - Contains metrics related to the libbeat library, including configuration, output, and pipeline statistics. - **system** (object) - Contains system-level metrics such as CPU cores and load averages. #### Response Example ```json { "beat": { "cpu": { "system": { "ticks": 1710, "time": { "ms": 1712 } }, "total": { "ticks": 3420, "time": { "ms": 3424 }, "value": 3420 }, "user": { "ticks": 1710, "time": { "ms": 1712 } } }, "info": { "ephemeral_id": "ab4287c4-d907-4d9d-b074-d8c3cec4a577", "uptime": { "ms": 195547 } }, "memstats": { "gc_next": 17855152, "memory_alloc": 9433384, "memory_total": 492478864, "rss": 50405376 }, "runtime": { "goroutines": 22 } }, "libbeat": { "config": { "module": { "running": 0, "starts": 0, "stops": 0 }, "scans": 1, "reloads": 1 }, "output": { "events": { "acked": 0, "active": 0, "batches": 0, "dropped": 0, "duplicates": 0, "failed": 0, "total": 0 }, "read": { "bytes": 0, "errors": 0 }, "type": "elasticsearch", "write": { "bytes": 0, "errors": 0 } }, "pipeline": { "clients": 6, "events": { "active": 716, "dropped": 0, "failed": 0, "filtered": 0, "published": 716, "retry": 278, "total": 716 }, "queue": { "acked": 0 } } }, "system": { "cpu": { "cores": 4 }, "load": { "1": 2.22, "15": 1.8, "5": 1.74, "norm": { "1": 0.555, "15": 0.45, "5": 0.435 } } } } ``` ```