Which beat runs? How do i know it?

I was trying to make a new beat that collects k6 metrics via rest api and then send them into Elasticsearch. I follow the 7.17 Dev Guide " Creating a Beat based on Metricbeat" documentation. But it's like my beat doesn't run instead of metricbeat runs.

2023-05-12T13:45:09.791+0300	INFO	instance/beat.go:697	Home path: [/home/zey/go/proje/src/github.com/zeynepyz/k6beat] Config path: [/home/zey/go/proje/src/github.com/zeynepyz/k6beat] Data path: [/home/zey/go/proje/src/github.com/zeynepyz/k6beat/data] Logs path: [/home/zey/go/proje/src/github.com/zeynepyz/k6beat/logs] Hostfs Path: [/]
2023-05-12T13:45:09.791+0300	INFO	instance/beat.go:705	Beat ID: c83fcc6f-39bb-47a8-bbe8-ab64875d2cfd
2023-05-12T13:45:12.793+0300	WARN	[add_cloud_metadata]	add_cloud_metadata/provider_aws_ec2.go:79	read token request for getting IMDSv2 token returns empty: Put "http://169.254.169.254/latest/api/token": context deadline exceeded (Client.Timeout exceeded while awaiting headers). No token in the metadata request will be used.
2023-05-12T13:45:12.796+0300	INFO	[seccomp]	seccomp/seccomp.go:124	Syscall filter successfully installed
2023-05-12T13:45:12.796+0300	INFO	[beat]	instance/beat.go:1051	Beat info	{"system_info": {"beat": {"path": {"config": "/home/zey/go/proje/src/github.com/zeynepyz/k6beat", "data": "/home/zey/go/proje/src/github.com/zeynepyz/k6beat/data", "home": "/home/zey/go/proje/src/github.com/zeynepyz/k6beat", "logs": "/home/zey/go/proje/src/github.com/zeynepyz/k6beat/logs"}, "type": "k6beat", "uuid": "c83fcc6f-39bb-47a8-bbe8-ab64875d2cfd"}}}
2023-05-12T13:45:12.796+0300	INFO	[beat]	instance/beat.go:1060	Build info	{"system_info": {"build": {"commit": "98f1871cebb932bc3393f5085c6f58b71e5982e3", "libbeat": "7.17.9", "time": "2023-03-08T16:19:53.000Z", "version": "7.17.9"}}}
2023-05-12T13:45:12.796+0300	INFO	[beat]	instance/beat.go:1063	Go runtime info	{"system_info": {"go": {"os":"linux","arch":"amd64","max_procs":16,"version":"go1.18.9"}}}
2023-05-12T13:45:12.798+0300	INFO	[beat]	instance/beat.go:1067	Host info	{"system_info": {"host": {"architecture":"x86_64","boot_time":"2023-05-12T12:34:02+03:00","containerized":false,"name":"zeymira","ip":["127.0.0.1/8","::1/128","192.168.1.106/24","fe80::604c:8b18:3c23:8ff8/64","192.168.1.108/24","fe80::9cd1:460c:aa92:dffb/64","172.17.0.1/16"],"kernel_version":"5.19.0-41-generic","mac":["b0:25:aa:40:88:a7","70:9c:d1:e8:ee:0a","02:42:b5:d1:20:0c"],"os":{"type":"linux","family":"debian","platform":"ubuntu","name":"Ubuntu","version":"22.04.2 LTS (Jammy Jellyfish)","major":22,"minor":4,"patch":2,"codename":"jammy"},"timezone":"+03","timezone_offset_sec":10800,"id":"b8cc74588f7a467d90b92235da363ead"}}}
2023-05-12T13:45:12.799+0300	INFO	[beat]	instance/beat.go:1096	Process info	{"system_info": {"process": {"capabilities": {"inheritable":null,"permitted":null,"effective":null,"bounding":["chown","dac_override","dac_read_search","fowner","fsetid","kill","setgid","setuid","setpcap","linux_immutable","net_bind_service","net_broadcast","net_admin","net_raw","ipc_lock","ipc_owner","sys_module","sys_rawio","sys_chroot","sys_ptrace","sys_pacct","sys_admin","sys_boot","sys_nice","sys_resource","sys_time","sys_tty_config","mknod","lease","audit_write","audit_control","setfcap","mac_override","mac_admin","syslog","wake_alarm","block_suspend","audit_read","38","39","40"],"ambient":null}, "cwd": "/home/zey/go/proje/src/github.com/zeynepyz/k6beat", "exe": "/home/zey/go/proje/src/github.com/zeynepyz/k6beat/k6beat", "name": "k6beat", "pid": 7102, "ppid": 5257, "seccomp": {"mode":"filter","no_new_privs":true}, "start_time": "2023-05-12T13:45:09.279+0300"}}}
2023-05-12T13:45:12.799+0300	INFO	instance/beat.go:291	Setup Beat: k6beat; Version: 7.17.9
2023-05-12T13:45:12.799+0300	INFO	[index-management]	idxmgmt/std.go:184	Set output.elasticsearch.index to 'k6beat-7.17.9' as ILM is enabled.
2023-05-12T13:45:12.799+0300	INFO	[esclientleg]	eslegclient/connection.go:105	elasticsearch url: http://localhost:9200
2023-05-12T13:45:12.799+0300	INFO	[publisher]	pipeline/module.go:113	Beat name: zeymira
2023-05-12T13:45:12.799+0300	INFO	[monitoring]	log/log.go:142	Starting metrics logging every 30s
2023-05-12T13:45:12.799+0300	INFO	instance/beat.go:456	k6beat start running.
2023-05-12T13:45:12.799+0300	INFO	cfgfile/reload.go:164	Config reloader started
2023-05-12T13:45:12.799+0300	INFO	cfgfile/reload.go:224	Loading of config files completed.
2023-05-12T13:45:12.860+0300	INFO	[add_cloud_metadata]	add_cloud_metadata/add_cloud_metadata.go:101	add_cloud_metadata: hosting provider type not detected.
2023-05-12T13:45:42.823+0300	INFO	[monitoring]	log/log.go:184	Non-zero metrics in the last 30s	{"monitoring": {"metrics": {"beat":{"cgroup":{"cpu":{"id":"vte-spawn-ced4d177-6993-40bf-a338-cefb17d1849c.scope"},"memory":{"id":"vte-spawn-ced4d177-6993-40bf-a338-cefb17d1849c.scope","mem":{"usage":{"bytes":44662784}}}},"cpu":{"system":{"ticks":30,"time":{"ms":31}},"total":{"ticks":40,"time":{"ms":49},"value":40},"user":{"ticks":10,"time":{"ms":18}}},"handles":{"limit":{"hard":1048576,"soft":1024},"open":8},"info":{"ephemeral_id":"ce8153af-257a-4c32-a081-b19a55ac1e02","uptime":{"ms":33020},"version":"7.17.9"},"memstats":{"gc_next":6558440,"memory_alloc":4581264,"memory_sys":22103048,"memory_total":10075336,"rss":38436864},"runtime":{"goroutines":29}},"libbeat":{"config":{"module":{"running":0},"reloads":1,"scans":1},"output":{"events":{"active":0},"type":"elasticsearch"},"pipeline":{"clients":0,"events":{"active":0},"queue":{"max_events":4096}}},"system":{"cpu":{"cores":16},"load":{"1":0.45,"15":0.19,"5":0.35,"norm":{"1":0.0281,"15":0.0119,"5":0.0219}}}}}}

this is my output. But k6 doesn't run so i expect to have an error message but no. Also when i run k6beat modules enable it doesn't show anything. But im sure that there is a k6module in yml file and it enabled. Can someone please help me? I'm stuck at this point couldn't figure it out.


#==========================  Modules configuration ============================

k6beat.config.modules:
  # Glob pattern for configuration loading
  path: $GOPATH/proje/src/github.com/zeynepyz/k6beat/modules.d/*.yml
  modules:
    enabled:
      - k6module


  # Set to true to enable config reloading
  reload.enabled: false

  # Period on which files under path should be checked for changes
  #reload.period: 10s

#==================== Elasticsearch template setting ==========================

setup.template.settings:
  index.number_of_shards: 1
  index.codec: best_compression
  #_source.enabled: false

# ================================== General ===================================

# The name of the shipper that publishes the network data. It can be used to group
# all the transactions sent by a single shipper in the web interface.
#name:

# The tags of the shipper are included in their own field with each
# transaction published.
#tags: ["service-X", "web-tier"]

# Optional fields that you can specify to add additional information to the
# output.
#fields:
#  env: staging

# ================================= Dashboards =================================
# These settings control loading the sample dashboards to the Kibana index. Loading
# the dashboards is disabled by default and can be enabled either by setting the
# options here or by using the `setup` command.
#setup.dashboards.enabled: false

# The URL from where to download the dashboards archive. By default this URL
# has a value which is computed based on the Beat name and version. For released
# versions, this URL points to the dashboard archive on the artifacts.elastic.co
# website.
#setup.dashboards.url:

# =================================== Kibana ===================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  #host: "localhost:5601"

  # Kibana Space ID
  # ID of the Kibana Space into which the dashboards should be loaded. By default,
  # the Default Space will be used.
  #space.id:

# =============================== Elastic Cloud ================================

# These settings simplify using K6beat with the Elastic Cloud (https://cloud.elastic.co/).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` and
# `setup.kibana.host` options.
# You can find the `cloud.id` in the Elastic Cloud web UI.
#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
#cloud.auth:

# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]

  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  #username: "elastic"
  #password: "changeme"

# ------------------------------ Logstash Output -------------------------------
#output.logstash:
  # The Logstash hosts
  #hosts: ["localhost:5044"]

  # Optional SSL. By default is off.
  # List of root certificates for HTTPS server verifications
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

  # Certificate for SSL client authentication
  #ssl.certificate: "/etc/pki/client/cert.pem"

  # Client Certificate Key
  #ssl.key: "/etc/pki/client/cert.key"

# ================================= Processors =================================

# Configure processors to enhance or manipulate events generated by the beat.

processors:
  - add_host_metadata: ~
  - add_cloud_metadata: ~
  - add_docker_metadata: ~


# ================================== Logging ===================================

# Sets log level. The default log level is info.
# Available log levels are: error, warning, info, debug
#logging.level: debug

# At debug level, you can selectively enable logging only for some components.
# To enable all selectors use ["*"]. Examples of other selectors are "beat",
# "publisher", "service".
#logging.selectors: ["*"]

# ============================= X-Pack Monitoring ==============================
# K6beat can export internal metrics to a central Elasticsearch monitoring
# cluster.  This requires xpack monitoring to be enabled in Elasticsearch.  The
# reporting is disabled by default.

# Set to true to enable the monitoring reporter.
#monitoring.enabled: false

# Sets the UUID of the Elasticsearch cluster under which monitoring data for this
# K6beat instance will appear in the Stack Monitoring UI. If output.elasticsearch
# is enabled, the UUID is derived from the Elasticsearch cluster referenced by output.elasticsearch.
#monitoring.cluster_uuid:

# Uncomment to send the metrics to Elasticsearch. Most settings from the
# Elasticsearch output are accepted here as well.
# Note that the settings should point to your Elasticsearch *monitoring* cluster.
# Any setting that is not set is automatically inherited from the Elasticsearch
# output configuration, so if you have the Elasticsearch output configured such
# that it is pointing to your Elasticsearch monitoring cluster, you can simply
# uncomment the following line.
#monitoring.elasticsearch:

# ============================== Instrumentation ===============================

# Instrumentation support for the k6beat.
#instrumentation:
    # Set to true to enable instrumentation of k6beat.
    #enabled: false

    # Environment in which k6beat is running on (eg: staging, production, etc.)
    #environment: ""

    # APM Server hosts to report instrumentation results to.
    #hosts:
    #  - http://localhost:8200

    # API Key for the APM Server(s).
    # If api_key is set then secret_token will be ignored.
    #api_key:

    # Secret token for the APM Server(s).
    #secret_token:


# ================================= Migration ==================================

# This allows to enable 6.7 migration aliases
#migration.6_to_7.enabled: true


(this is the k6beat.yml file)

1 Like

I can see k6beat start running but since this is based on your custom Beat (and github.com/zeynepyz/k6beat seems to be a private repo), it's hard to guess what's happening there. You might have to add more log output to your custom logic to see what it is or isn't doing?

i just couldn't handle it and delete this beat then create another and it solved but thanks for the reply

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.