vCenter tells you a datastore went inaccessible. It rarely tells you that the host logged its first NFS timeout four minutes earlier, that two other hosts on the same array saw the same thing, or that a SCSI sense code from the array was the real cause. That detail lives in vmkernel.log, vobd.log and hostd.log on every host, and most teams only read it after the incident, over SSH, one host at a time. This part of the series streams those logs off every ESXi host into an OpenTelemetry Collector, turns the lines that matter into structured events (APD, PDL, SCSI sense codes, vMotion failures, hostd crashes, VOB problems), stamps each one with the host name, and lands it in Loki where it can sit on the same Grafana screen as the vCenter metrics from part 2.

Level: intermediate  ·  Stack: ESXi 7.0 U3 or 8.0, ESX 9, otelcol-contrib 0.166.0, Loki 3.x, VCF PowerCLI 9  ·  Build time: about 60 minutes for a first cluster


Contents

  1. What we are building
  2. How ESXi syslog actually works
  3. Transport and format decisions
  4. Configure every host with PowerCLI
  5. The esxcli equivalents
  6. Collector side: the syslog receiver
  7. The parsing pipeline
  8. Parsing rules for the events that matter
  9. The full collector configuration
  10. Sample lines and what they become
  11. End-to-end workflow
  12. Troubleshooting
  13. Running it at scale

01. What we are building

Every ESXi host already runs a syslog daemon, vmsyslogd, that can forward everything it writes locally to one or more remote targets. We point those targets at an OpenTelemetry Collector running the contrib distribution. The collector does three jobs: it terminates the syslog TCP streams, it parses each line into an OpenTelemetry log record with a proper timestamp, severity and resource, and it exports the result over OTLP to Loki. Nothing is installed on the hosts. The only host-side change is one advanced setting and one firewall ruleset.

ESXi HOSTS OPTIONAL COLLECT AND PARSE STORE AND VIEW esx01.lab.local vmsyslogd, logHost esx02.lab.local vmsyslogd, logHost esx03 … esxNN same PowerCLI template or direct, no relay Relay or L4 LB HAProxy TCP mode or keepalived VIP balances connections OTel Collector otelcol-contrib gateway syslog/esx_3164 :1514 syslog/esx_5424 :5514 memory_limiter transform/esx_events otlp_http/loki + queue Loki native OTLP, /otlp port 3100 Grafana Explore, dashboards APD alert rule Transport: TCP 1514 with RFC 3164 works on every 7.x, 8.x and 9.x host. TCP 5514 with RFC 5424 and octet counting is for 8.0 U3 and later. UDP drops under load; SSL needs a certificate the hosts trust (section 03). vmkernel vmkwarning Hostd Vpxa vobd Fdm (HA) clomd (vSAN) and more
ESXi hosts forward syslog over TCP, directly or through an optional relay, to a gateway collector that parses vmkernel, hostd and vobd lines and exports them to Loki.
ComponentJobWhy this one
vmsyslogd on each hostWrites local log files and forwards the same messages to Syslog.global.logHostAlready there, supported, and covers every log the host produces. No VIBs, no agents.
Syslog receiver (syslog, beta)Frames the TCP stream, parses the RFC 3164 or RFC 5424 headerHandles octet counting and both RFCs. Its operator chain runs before the data enters the pipeline, which is where resource attributes have to be set.
Transform processor (transform, beta)OTTL statements that classify storage, vMotion and crash eventsReadable rules you can version and test, applied once per record.
otlp_http exporter (stable for logs)Ships OTLP to Loki’s native /otlp endpointNo Loki-specific exporter needed. The old loki exporter was deprecated in July 2024 and has since been removed from contrib.
LokiStores the logs, indexes a small label set, keeps the rest as structured metadataCheap at ESXi volumes, and queries in the same Grafana as the metrics. Part 4 covers its configuration.

Scope. This post covers ESXi host logs. vCenter Server Appliance logs (vpxd, sps, eam) are forwarded separately from the VAMI and are a different format. VCF Operations for Logs (formerly Aria Operations for Logs and Log Insight) can keep running alongside, since ESXi happily sends to several targets at once.

02. How ESXi syslog actually works

On ESXi 5.0 and later the syslog service is vmsyslogd. Programs on the host (the VMkernel, hostd, vpxa, vobd, fdm, and the vSAN daemons on vSAN hosts) log to it, and it does two things with each message: writes it to a file under /var/run/log (with /var/log as the familiar path), and, if any remote targets are configured, sends a copy to each of them. The files and the remote stream carry the same messages, which is why everything you know from reading files over SSH carries over.

The logs worth forwarding

File / app nameWhat is in itWhy you want it in OTel
vmkernel.log / vmkernelCore VMkernel: storage and network device and driver events, NFS, PSA and NMP path handling, APD and PDL handling, VM startup, vMotion data pathNearly every storage incident starts here. SCSI sense codes, NFS disconnects and APD transitions are all vmkernel lines.
vmkwarning.log / vmkwarningWarning and alert lines excerpted from vmkernelA pre-filtered view. Expect the same message twice if you collect both.
hostd.log / HostdHost management service: tasks, events, vSphere Client and vpxa communicationTask failures, and the opID that ties a host task back to a vCenter task.
vpxa.log / VpxavCenter agent on the hostHost disconnects from vCenter usually show up here first.
vobd.log / vobdVMkernel Observations: structured events such as esx.problem.*The closest thing ESXi has to a typed event bus. These IDs are what vCenter turns into events and alarms.
fdm.log / FdmvSphere HA agentHA isolation and failover decisions.
clomd.log and friendsvSAN cluster object manager and related daemons (vSAN hosts only)Object placement and resync behaviour on vSAN clusters.
vmsyslogd-dropped.logMessages vmsyslogd had to drop because of buffer overflow or an unreachable destinationThe first file to check when you suspect gaps.

ESXi 8.0 standardised the on-disk format and the transmitted format. A local line now carries a severity code with a number, for example In(182) vmkernel: or Wa(180) vmkwarning:. The number is the syslog priority, facility times eight plus severity, so 182 is local6.info and 180 is local6.warning. On the wire that information lives in the PRI header, <182>, which is exactly what the collector decodes. Broadcom documents the 8.0 format change and notes that it cannot be reverted to the 7.0 layout.

The settings that control forwarding

Advanced settingesxcli flagWhat it does
Syslog.global.logHost--loghostComma separated list of targets in the form protocol://target[:port][?formatter=value[&framing=value]]. Protocol is udp, tcp or ssl. Broadcom recommends five targets or fewer.
Syslog.global.remoteHost.maxMsgLen--remote-host-max-msg-lenMaximum transmitted message length. Default 1 KiB, maximum 16 KiB, longer messages are truncated. Before 8.0 U3i it applied to TCP and SSL only; UDP was capped at 480 bytes (IPv4).
Syslog.global.remoteHost.connectRetryDelay--default-timeoutSeconds before retrying a failed remote connection.
Syslog.global.msgQueueDropMark--queue-drop-markQueue fill percentage at which messages start being dropped.
Syslog.global.logLevel--log-levelFiltering level of vmsyslogd itself (debug, info, warning, error). Leave it at info; it is for troubleshooting the daemon, not for reducing volume.
Syslog.global.certificate.checkSSLCerts--check-ssl-certsEnforce certificate checks for ssl:// targets.

The formatter parameter takes RFC_3164 (the default) or RFC_5424. The framing parameter takes non_transparent (the default, newline separated) or octet_counting (each message prefixed with its length). Broadcom is explicit that RFC 5424 transmissions must use octet counting, and that RFC 5424 support arrived with ESXi 8.0. A 7.x host rejects the query string entirely and reports an invalid port.

03. Transport and format decisions

Four choices decide whether this pipeline is reliable or merely present. Make them once, write them down, and apply them with the script in section 04.

Decision 01: TCP, not UDP

UDP is the ESXi default people reach for because it needs nothing on the far side. It also loses messages silently whenever the network or the receiver is busy, and the busiest moment for both is a storage incident, which is exactly when you need the logs. Broadcom’s own guidance says to avoid UDP when capturing messages is critical. Use TCP. vmsyslogd buffers and reconnects, and the collector applies back-pressure instead of dropping. Use SSL when the logs cross a network you do not own; the collector’s TCP input takes a tls block with cert_file and key_file, and the hosts must trust the issuing CA.

Decision 02: RFC 3164 as the baseline, RFC 5424 where you can

RFC 3164 (default)RFC 5424 + octet counting
Host versionsEvery 7.x, 8.x and 9.x host8.0 and later only
TimestampNov 30 10:15:02: second precision, no year, no time zone2026-11-30T10:15:02.123Z: milliseconds and explicit UTC
FramingNewline. A message containing a newline splits in twoLength prefix. Multi-line safe
Extra fieldsNoneProcess ID, structured data such as [Originator@6876 sub=... opID=...]
Parser strictnessForgivingStrict. Early 8.0 U2 builds emitted an extra NILVALUE and unquoted SD values that strict parsers reject

Run both. The configuration in section 09 listens for RFC 3164 on TCP 1514 and RFC 5424 on TCP 5514, so a mixed estate does not need two collectors. Point 7.x hosts at the first, 8.0 U3 and 9.x hosts at the second, and if the debug exporter shows 5424 records arriving without an appname attribute, the build you are on emits something the strict parser does not accept: move that host to 1514 until it is patched.

Decision 03: ports and the ESXi firewall

The built-in syslog firewall ruleset opens outbound UDP 514, TCP 514 and TCP 1514. On ESXi 8.0 U2b and later, a non-standard port in logHost creates a dynamic firewall rule automatically; on earlier builds a custom port needs a custom ruleset VIB, which is not worth it. That is why the baseline listener is 1514: it is inside the standard ruleset on every version, and it is above 1024, so the collector does not need root or CAP_NET_BIND_SERVICE to bind it. Port 5514 for RFC 5424 relies on the dynamic rule, which every host capable of RFC 5424 output at 8.0 U2b or later has. Always write the port explicitly: the documented TCP default has differed between versions of the docs (514 in some, 1514 in others).

Decision 04: one host, one resource

In OpenTelemetry the host that produced a log belongs on the resource, as host.name, not on each record as an attribute. Get this wrong and Loki cannot index by host, and correlation with vCenter metrics in part 4 has nothing to join on. The syslog receiver parses into record attributes, so the configuration moves the parsed hostname to resource["host.name"] inside the receiver’s operator chain. That placement matters: the receiver groups records by resource when it builds a batch, so setting it there gives each host its own resource. Setting a resource attribute later in the transform processor, from a log record, would overwrite the resource for every record in the batch, and you would end up with logs from 40 hosts labelled with whichever host came last.

04. Configure every host with PowerCLI

Clicking through 40 hosts in the vSphere Client is how configurations drift. The script below is the template I use. It appends the collector to Syslog.global.logHost rather than replacing it, so an existing VCF Operations for Logs target keeps working; it enables the syslog firewall ruleset; it reloads vmsyslogd; and it writes a marker message with esxcli system syslog mark, which you search for in Loki to prove the path end to end. It honours -WhatIf, so run it dry first.

# Set-EsxSyslogOtel.ps1
# Point ESXi hosts at the OpenTelemetry syslog collector without dropping existing targets,
# open the syslog firewall ruleset, reload vmsyslogd and send a marker line you can search for.
# Requires: VCF PowerCLI 9.x (module VCF.PowerCLI) or VMware PowerCLI 13.x, PowerShell 7.
# Credentials come from the environment: VCENTER_USERNAME, VCENTER_PASSWORD.
#
# Dry run:  ./Set-EsxSyslogOtel.ps1 -VCenter vcenter01.lab.local -Cluster 'Prod-*' -CollectorUri 'tcp://otelgw01.lab.local:1514' -WhatIf
# Apply:    ./Set-EsxSyslogOtel.ps1 -VCenter vcenter01.lab.local -Cluster 'Prod-*' -CollectorUri 'tcp://otelgw01.lab.local:1514'

[CmdletBinding(SupportsShouldProcess)]
param(
    [Parameter(Mandatory)] [string] $VCenter,          # <VCENTER_FQDN>
    [Parameter(Mandatory)] [string] $CollectorUri,     # tcp://<COLLECTOR_FQDN>:1514
    [string] $Cluster = '*',                           # wildcard allowed
    [switch] $ReplaceExisting,                         # default is append, never clobber
    [string] $ReportPath = "./esx-syslog-$(Get-Date -Format yyyyMMdd-HHmmss).csv"
)

$ErrorActionPreference = 'Stop'

if (-not $env:VCENTER_USERNAME -or -not $env:VCENTER_PASSWORD) {
    throw 'Set VCENTER_USERNAME and VCENTER_PASSWORD in the environment first.'
}
$secure = ConvertTo-SecureString $env:VCENTER_PASSWORD -AsPlainText -Force
$cred   = [pscredential]::new($env:VCENTER_USERNAME, $secure)

$null = Connect-VIServer -Server $VCenter -Credential $cred

$report = foreach ($vmhost in (Get-Cluster -Name $Cluster | Get-VMHost |
          Where-Object { $_.ConnectionState -in 'Connected', 'Maintenance' } | Sort-Object Name)) {

    $row = [ordered]@{ Host = $vmhost.Name; Version = "$($vmhost.Version) build $($vmhost.Build)";
                       Before = ''; After = ''; Firewall = ''; Status = 'ok' }
    try {
        # 1. Syslog.global.logHost: append the collector, keep any existing targets
        $setting = Get-AdvancedSetting -Entity $vmhost -Name 'Syslog.global.logHost'
        $current = @("$($setting.Value)".Split(',') | ForEach-Object { $_.Trim() } | Where-Object { $_ })
        $row.Before = $current -join ','

        $target = if ($ReplaceExisting) { @($CollectorUri) }
                  elseif ($current -contains $CollectorUri) { $current }
                  else { @($current) + $CollectorUri }
        $value = $target -join ','
        $row.After = $value

        if ($value -ne $row.Before -and $PSCmdlet.ShouldProcess($vmhost.Name, "Syslog.global.logHost = $value")) {
            $null = $setting | Set-AdvancedSetting -Value $value -Confirm:$false
        }

        # 2. Outbound syslog ruleset (covers the standard ports; 8.0 U2b+ adds dynamic rules for others)
        $fw = Get-VMHostFirewallException -VMHost $vmhost -Name 'syslog'
        if (-not $fw.Enabled -and $PSCmdlet.ShouldProcess($vmhost.Name, 'Enable syslog firewall ruleset')) {
            $null = $fw | Set-VMHostFirewallException -Enabled $true
        }
        $row.Firewall = (Get-VMHostFirewallException -VMHost $vmhost -Name 'syslog').Enabled

        # 3. Reload vmsyslogd and write a marker line into every log stream
        if ($PSCmdlet.ShouldProcess($vmhost.Name, 'esxcli system syslog reload + mark')) {
            $esxcli = Get-EsxCli -VMHost $vmhost -V2
            $null = $esxcli.system.syslog.reload.Invoke()
            $null = $esxcli.system.syslog.mark.Invoke(@{ message = "otel-syslog-check $($vmhost.Name)" })
        }
    }
    catch {
        $row.Status = "failed: $($_.Exception.Message)"
    }
    [pscustomobject]$row
}

$report | Format-Table -AutoSize
$report | Export-Csv -Path $ReportPath -NoTypeInformation
Write-Host "Report written to $ReportPath"
Disconnect-VIServer -Server $VCenter -Confirm:$false

PowerCLI was renamed VCF PowerCLI at 9.0 and installs with Install-Module VCF.PowerCLI; it requires PowerShell 7. The cmdlets used here (Get-AdvancedSetting, Set-AdvancedSetting, Get-VMHostFirewallException, Set-VMHostFirewallException, Get-EsxCli -V2) are unchanged from VMware PowerCLI 13, so the script runs against vCenter 7, 8 and 9 alike.

Who else writes logHost? If a cluster is managed by vSphere Configuration Profiles, put the syslog setting in the profile, or remediation will put the old value back. The same applies if VCF Operations for Logs manages ESXi log forwarding for you: it can rewrite logHost on its own schedule (Broadcom has a KB about settings reverting due to automated API calls). Decide which system owns the setting, and make the other one append.

05. The esxcli equivalents

For a single host, a host that is not yet in vCenter, or a kickstart script, the same change in esxcli:

# Inspect current state
esxcli system syslog config get
esxcli network firewall ruleset list --ruleset-id=syslog

# Baseline: RFC 3164 over TCP 1514 (7.x, 8.x, 9.x)
esxcli system syslog config set --loghost='tcp://<COLLECTOR_FQDN>:1514'

# Or, on 8.0 and later: RFC 5424 with octet counting on TCP 5514
esxcli system syslog config set --loghost='tcp://<COLLECTOR_FQDN>:5514?formatter=RFC_5424&framing=octet_counting'

# Keep an existing target as well: comma separated, no spaces
esxcli system syslog config set --loghost='udp://<EXISTING_TARGET>:514,tcp://<COLLECTOR_FQDN>:1514'

# Optional: allow longer messages (TCP/SSL; UDP too from 8.0 U3i)
esxcli system syslog config set --remote-host-max-msg-len=4096

# Firewall, reload, marker
esxcli network firewall ruleset set --ruleset-id=syslog --enabled=true
esxcli network firewall refresh
esxcli system syslog reload
esxcli system syslog mark --message="otel-syslog-check $(hostname)"

# Is the TCP session up?
esxcli network ip connection list | grep -E ':1514|:5514'
nc -z <COLLECTOR_FQDN> 1514

Remember that esxcli changes to syslog options need esxcli system syslog reload to take effect, while changes made through the vSphere Client advanced settings restart the daemon for you.

06. Collector side: the syslog receiver

The syslog receiver in otelcol-contrib is beta for logs. A single receiver instance listens on either TCP or UDP, not both, so you declare one instance per listener and name them, for example syslog/esx_3164. The keys that matter for ESXi:

KeyValue for ESXiWhy
tcp.listen_address0.0.0.0:1514One listener per format. Use udp.listen_address instead for a UDP listener.
protocolrfc3164 or rfc5424Must match the host’s formatter. A mismatch parses nothing.
locationUTCRFC 3164 timestamps carry no zone. ESXi logs in UTC, so this must be UTC (it is also the default).
enable_octet_countingtrue for RFC 5424Matches framing=octet_counting. max_octets (default 8192) caps the message size it will accept.
tcp.max_log_size64KiBUpper bound on one entry for newline-framed TCP. The default is 1 MiB.
on_errorsend_quietA line the header parser rejects still flows through with its raw body, and the error is logged at debug level instead of flooding the collector log.
operatorssee section 07Stanza operators that run on each entry inside the receiver.

After the header parser, each record has the raw line in body and these attributes: hostname, appname, proc_id, msg_id, message, priority, facility and facility_text, plus structured_data and version for RFC 5424. The PRI severity becomes the record’s SeverityNumber and SeverityText (warning, err and so on), and the header timestamp becomes the record timestamp. Recent releases also added allow_rfc3339_timestamp and allow_second_fractions for RFC 3164 senders that use ISO timestamps; ESXi’s RFC 3164 output uses the classic Mmm dd hh:mm:ss form, so you do not need them.

07. The parsing pipeline

1. Framing TCP stream to records newline or octet count body (raw line) <180>Nov 30 10:15:02 esx01 vmkernel: cpu8:2097215)WARNING: NFS: 1985: Lost connection to the server 10.0.20.50 … 2. Syslog header syslog receiver rfc3164 or rfc5424 attributes appname=vmkernel hostname=esx01 message=cpu8:… facility_text=local6 priority=180 record fields timestamp: header severity: from PRI 3. Stanza operators inside the receiver per entry, pre-batch resource host.name=esx01 service.name=esxi service.namespace =vsphere attributes vmk_cpu=8 vmk_world=2097215 vmk_module=NFS severity WARN (13) 4. transform OTTL groups A to I classify and extract attributes esx.event= nfs_disconnect nfs.server=10.0.20.50 nfs.export=/vol/ds01 vcenter.datastore .name=nfs-ds01 body set to message header noise gone 5. Export otlp_http to Loki labels vs metadata Loki index labels service_name service_namespace (host_name: part 4) structured metadata host_name, esx_event nfs_server vmk_module, appname severity_text, … Stages 1 to 3 run inside the syslog receiver; resource is set there so every host becomes its own resource. Stage 4 runs once per record in the transform processor; stage 5 is decided by Loki, not the collector.
One vmkernel line through the five stages. The receiver does framing, header and resource; the transform processor does classification; Loki decides what becomes a label.

Two different engines do the parsing, and it is worth knowing why each rule lives where it does.

Stanza operators, inside the receiver

Operators are the log-agent heritage of the collector (the pkg/stanza library). They run per entry, before the receiver converts entries into an OpenTelemetry batch. That makes them the only correct place to set resource attributes from content, and a convenient place for cheap, always-on parsing. The chain in this build does four things:

  • add resource["host.name"] from EXPR(lower(attributes.hostname)), then remove the attribute. Lower-casing here saves a lot of grief in Grafana variables later.
  • add resource["service.name"] = esxi and service.namespace = vsphere. Loki uses service.name as its primary label; without it every stream is unknown_service. Every ESXi query in this series starts with {service_name="esxi"}.
  • regex_parser, guarded by if: attributes.appname in ["vmkernel", "vmkwarning"], splits the vmkernel prefix cpu8:2097215)WARNING: NFS: into vmk_cpu, vmk_world, vmk_level and vmk_module.
  • severity_parser, guarded by if: attributes.vmk_level in ["WARNING", "ALERT"], maps those markers to WARN and ERROR so that a warning is a warning regardless of the PRI the host chose.

The if guards are not decoration. An optional regex group that did not match still produces an empty-string attribute, and a severity parser fed an empty string maps it to the default level, overwriting the good severity from the PRI header. Guard every conditional operator, and use on_error: send_quiet so a line that does not match passes through untouched.

OTTL in the transform processor

Everything else is OTTL. Each rule is a statement group with a conditions list, so the regexes inside only run on lines that can match. The pattern is the same in every group: ExtractPatterns returns a map of named captures, merge_maps parks it in log.cache (a per-record scratch map), and set copies the pieces you want into attributes with OpenTelemetry style dotted names. Two details cost me time and will cost you time:

  • Go regular expressions do not allow dots in capture group names. (?P<storage.device>...) is a compile error, which is why captures use short names and are renamed by set.
  • set from a cache key that was never populated writes an empty attribute. Every copy carries where log.cache["key"] != nil.
  • In collector YAML, quote every OTTL statement in single quotes. A plain YAML scalar containing : (as in sense data: 0x5) is a YAML parse error, and inside single quotes backslashes are literal, so \\d in the file reaches the regex engine as \d.
  • The collector expands $ in configuration. Avoid $ regex anchors in OTTL strings, or write them as $$.

Groups run in order and later groups overwrite esx.event, so the ordering encodes precedence: a generic VOB match first, then NFS, APD, SCSI, PDL (which overrides scsi_error for the 0x5/0x25 sense combination), vMotion and crashes. The final group moves the human readable message into the body and drops header fields you do not want stored on every line.

08. Parsing rules for the events that matter

These are the rules in the configuration, explained. Line formats and the numbers after module names (NFS: 1985:) change between builds; the rules deliberately match on stable wording and never on those numbers. Before trusting a rule, run it against a day of your own vmkernel.log with the debug exporter, which is the workflow in section 11.

NFS server disconnect and restore

vmkernel prints Lost connection to the server <ip> mount point <export>, mounted as <uuid> ("<datastore>") and a matching restore line. The rule sets esx.event to nfs_disconnect or nfs_restore and extracts nfs.server, nfs.export and vcenter.datastore.name. That last name is deliberate: it is the same key the vCenter receiver puts on datastore metrics, so a log panel and a capacity panel can share one Grafana variable. The vobd versions of the same events (esx.problem.vmfs.nfs.server.disconnect and .restored) are mapped to the same values by the VOB rule. For the NFS client internals behind these messages, see NFSv3 and NFSv4.1 in vSphere.

All Paths Down and Permanent Device Loss

APD is the state where a device or an NFS datastore has no working path but the host cannot tell whether it will come back. The rule tags three transitions: apd_start (has entered the All Paths Down state, or APD start for), apd_timeout (All Paths Down Timeout state, after which I/O is fast failed, 140 seconds by default) and apd_exit. It extracts the identifier in brackets into storage.device, which is an naa. ID for block devices and a volume identifier for NFS. Start and timeout are raised to ERROR. PDL is the opposite case: the array has told the host the device is gone for good, typically with sense data 0x5 0x25 0x0 (ILLEGAL REQUEST, LOGICAL UNIT NOT SUPPORTED) or the has been removed or is permanently inaccessible message. Those become esx.event = pdl.

SCSI completion status and sense codes

A failed command in vmkernel ends with H:0xN D:0xN P:0xN and often Valid sense data: K A Q. The rule extracts all six values, plus the command opcode, device and path when present, into scsi.* and storage.* attributes. That turns a wall of hex into something you can count by device and by sense key. The values that come up most:

FieldValueMeaning
H (host)0x0 / 0x1 / 0x3 / 0x5 / 0x7 / 0x8OK / no connect / timeout / abort / internal error / reset
D (device)0x0 / 0x2 / 0x8 / 0x18 / 0x28Good / check condition (look at sense) / busy / reservation conflict / task set full (queue full)
P (plugin)0x0 / non-zeroNo plugin error / the multipathing plugin reported a condition
Sense key0x2 / 0x3 / 0x4 / 0x5 / 0x6 / 0xb / 0xeNot ready / medium error / hardware error / illegal request / unit attention / aborted command / miscompare
ASC/ASCQ0x25 0x0Logical unit not supported (a PDL condition)
ASC/ASCQ0x29 0x0Power on, reset or bus device reset occurred
ASC/ASCQ0x1d 0x0Miscompare during verify, the usual ATS (VAAI locking) miscompare

A steady trickle of D:0x2 ... 0x6 0x29 0x0 after an array controller failover is expected noise. A burst of H:0x5 aborts or D:0x28 queue-full is a performance incident in progress, and both are worth an alert.

vMotion failures

vMotion failures surface in vmkernel under the Migrate and VMotion modules (for example Migration considered a failure by the VMX, or the switchover time limit being reached) and as failed tasks in hostd. The rule is intentionally broad: any line mentioning vMotion or migration that also says fail, timeout, exceeded or abort becomes vmotion_failure, and where the vmkernel line carries a migration ID and an S: or D: role, those become vmotion.migration_id and vmotion.role. With the migration ID you can line up the source and destination halves of the same failed migration across two hosts. Background on the phases is in vMotion deep dive.

hostd and other user-world crashes

When a user-world process crashes, vmkernel logs wantCoreDump:<process> and a Dumping cartel ... to file /var/core/... line, and vobd raises esx.problem.application.core.dumped with a sentence naming the binary. The rule sets esx.event = uw_crash, extracts process.executable.name and esx.core_file, and upgrades the event to hostd_crash or vpxa_crash for the two processes whose loss disconnects a host from vCenter.

VOB events

vobd lines carry a correlator, an uptime in microseconds and a bracketed ID, [esx.problem.storage.apd.start]. The VOB rule extracts any vob.* or esx.* ID into esx.vob.id and raises anything in esx.problem.* to at least WARN. That one rule gives you the full catalogue of host problems vCenter knows about, as a queryable field, without writing a regex per event.

vCenter operation IDs

hostd and vpxa lines include opID=... inside the [Originator@6876 ...] block. The first rule pulls it into vsphere.op_id from the raw line, so it works for both RFC formats. Searching Loki for an opID from a failed vCenter task shows you every host line that task touched.

09. The full collector configuration

This is the complete configuration. It validates with otelcol-contrib validate on 0.166.0, and it has been run against the sample lines in section 10. Set LOKI_OTLP_URL in the collector’s environment, for example in /etc/otelcol-contrib/otelcol-contrib.conf for the packaged systemd service. Component names use the snake_case forms introduced across the v0.144 to v0.154 releases (otlp_http, not otlphttp), and batching is done by the exporter’s sending_queue, because the batch processor is deprecated as of 0.166.0.

# /etc/otelcol-contrib/config.yaml  (ESXi syslog -> OpenTelemetry -> Loki)
# Collector: otelcol-contrib 0.166.0 (validated with otelcol-contrib validate)
# Required env: LOKI_OTLP_URL  e.g. http://loki01.lab.local:3100/otlp

extensions:
  health_check:
    endpoint: 0.0.0.0:13133
  file_storage/queue:
    directory: /var/lib/otelcol/queue
    create_directory: true

receivers:
  # Baseline: every ESXi 7.x / 8.x / ESX 9.x host, default RFC 3164 formatter, TCP.
  # Host side: Syslog.global.logHost = tcp://<COLLECTOR_FQDN>:1514
  syslog/esx_3164:
    tcp:
      listen_address: 0.0.0.0:1514
      max_log_size: 64KiB
    protocol: rfc3164
    location: UTC
    on_error: send_quiet
    operators: &esx_operators
      # 1. host.name on the RESOURCE, lower-cased, so each host gets its own resource
      - type: add
        id: set_host_name
        field: resource["host.name"]
        value: EXPR(lower(attributes.hostname))
        on_error: send_quiet
      - type: remove
        id: drop_hostname_attr
        field: attributes.hostname
        on_error: send_quiet
      - type: add
        id: set_service_name
        field: resource["service.name"]
        value: esxi
      - type: add
        id: set_service_namespace
        field: resource["service.namespace"]
        value: vsphere
      # 2. split the vmkernel prefix "cpu12:2097835)WARNING: NFS: ..."
      - type: regex_parser
        id: vmkernel_prefix
        if: 'attributes.appname in ["vmkernel", "vmkwarning"]'
        parse_from: attributes.message
        parse_to: attributes
        regex: '^cpu(?P<vmk_cpu>\d+):(?P<vmk_world>\d+)\)(?:(?P<vmk_level>WARNING|ALERT): )?(?P<vmk_module>[A-Za-z0-9_]+):'
        on_error: send_quiet
      # 3. make vmkernel WARNING/ALERT lines WARN/ERROR whatever PRI the host used
      - type: severity_parser
        id: vmkernel_severity
        if: 'attributes.vmk_level in ["WARNING", "ALERT"]'
        parse_from: attributes.vmk_level
        mapping:
          warn: WARNING
          error: ALERT
        overwrite_text: true
        on_error: send_quiet

  # Optional: ESXi 8.0 and later (8.0 U3 recommended) / ESX 9.x, RFC 5424 + octet counting.
  # Host side: tcp://<COLLECTOR_FQDN>:5514?formatter=RFC_5424&framing=octet_counting
  syslog/esx_5424:
    tcp:
      listen_address: 0.0.0.0:5514
      max_log_size: 64KiB
    protocol: rfc5424
    enable_octet_counting: true
    max_octets: 16384
    on_error: send_quiet
    operators: *esx_operators

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 80
    spike_limit_percentage: 25

  transform/esx_events:
    error_mode: ignore
    log_statements:
      # A. vCenter operation ID (hostd, vpxa), from the raw line so it works for 3164 and 5424
      - context: log
        conditions:
          - 'IsMatch(log.body, "opI[Dd]=")'
        statements:
          - 'merge_maps(log.cache, ExtractPatterns(log.body, "opI[Dd]=\"?(?P<opid>[^ \\]\"]+)"), "upsert")'
          - 'set(log.attributes["vsphere.op_id"], log.cache["opid"]) where log.cache["opid"] != nil'

      # B. VOB / esx.problem events (vobd, plus vmkernel and hostd echoes)
      - context: log
        conditions:
          - 'IsMatch(log.attributes["message"], "\\[(vob|esx)\\.[A-Za-z0-9_.]+\\]")'
        statements:
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "\\[(?P<vob_id>(?:vob|esx)\\.[A-Za-z0-9_.]+)\\]"), "upsert")'
          - 'set(log.attributes["esx.vob.id"], log.cache["vob_id"]) where log.cache["vob_id"] != nil'
          - 'set(log.attributes["esx.event"], "vob")'
          - 'set(log.attributes["esx.event"], "nfs_disconnect") where log.cache["vob_id"] == "esx.problem.vmfs.nfs.server.disconnect"'
          - 'set(log.attributes["esx.event"], "nfs_restore") where log.cache["vob_id"] == "esx.problem.vmfs.nfs.server.restored"'
          - 'set(log.severity_number, SEVERITY_NUMBER_WARN) where IsMatch(log.cache["vob_id"], "^esx\\.problem\\.") and log.severity_number < SEVERITY_NUMBER_WARN'
          - 'set(log.severity_text, "WARN") where IsMatch(log.cache["vob_id"], "^esx\\.problem\\.") and log.severity_number == SEVERITY_NUMBER_WARN'

      # C. NFS connection loss / restore as printed by vmkernel
      - context: log
        conditions:
          - 'IsMatch(log.attributes["message"], "onnection to (the )?server .* mount point")'
        statements:
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "(?P<state>Lost connection to|Restored connection to|Connection to) (?:the )?server (?P<server>[^ ]+) mount point (?P<export>[^ ,]+),? mounted as (?P<uuid>[0-9a-fA-F-]+) \\(\"?(?P<ds>[^\")]+)\"?\\)"), "upsert")'
          - 'set(log.attributes["esx.event"], "nfs_disconnect") where log.cache["state"] == "Lost connection to"'
          - 'set(log.attributes["esx.event"], "nfs_restore") where log.cache["state"] != nil and log.cache["state"] != "Lost connection to"'
          - 'set(log.attributes["nfs.server"], log.cache["server"]) where log.cache["server"] != nil'
          - 'set(log.attributes["nfs.export"], log.cache["export"]) where log.cache["export"] != nil'
          - 'set(log.attributes["vcenter.datastore.name"], log.cache["ds"]) where log.cache["ds"] != nil'

      # D. All Paths Down: start, timeout, exit
      - context: log
        conditions:
          - 'IsMatch(log.attributes["message"], "All Paths Down|APD (start|[Ee]xit|[Tt]imeout)")'
        statements:
          - 'set(log.attributes["esx.event"], "apd_start") where IsMatch(log.attributes["message"], "has entered the All Paths Down state|APD start for")'
          - 'set(log.attributes["esx.event"], "apd_timeout") where IsMatch(log.attributes["message"], "All Paths Down Timeout state|APD [Tt]imeout event")'
          - 'set(log.attributes["esx.event"], "apd_exit") where IsMatch(log.attributes["message"], "exited the All Paths Down state|APD [Ee]xit for")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "(?:identifier|for(?: ident)?(?: 0x[0-9a-fA-F]+)?) \\[(?P<dev>[^\\] ]+)\\]"), "upsert")'
          - 'set(log.attributes["storage.device"], log.cache["dev"]) where log.cache["dev"] != nil'
          - 'set(log.severity_number, SEVERITY_NUMBER_ERROR) where log.attributes["esx.event"] == "apd_start" or log.attributes["esx.event"] == "apd_timeout"'
          - 'set(log.severity_text, "ERROR") where log.attributes["esx.event"] == "apd_start" or log.attributes["esx.event"] == "apd_timeout"'

      # E. SCSI completion status and sense data: H:0x0 D:0x2 P:0x0 Valid sense data: 0x6 0x29 0x0
      - context: log
        conditions:
          - 'IsMatch(log.attributes["message"], "H:0x[0-9a-fA-F]+ D:0x[0-9a-fA-F]+ P:0x[0-9a-fA-F]+")'
        statements:
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "H:(?P<h>0x[0-9a-fA-F]+) D:(?P<d>0x[0-9a-fA-F]+) P:(?P<p>0x[0-9a-fA-F]+)"), "upsert")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "(?:Valid|Possible) sense data: (?P<key>0x[0-9a-fA-F]+) (?P<asc>0x[0-9a-fA-F]+) (?P<ascq>0x[0-9a-fA-F]+)"), "upsert")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "dev \"(?P<dev>[^\"]+)\""), "upsert")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "path \"(?P<path>[^\"]+)\""), "upsert")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "Cmd(?:\\(0x[0-9a-fA-F]+\\))? (?P<cmd>0x[0-9a-fA-F]{1,2})\\b"), "upsert")'
          - 'set(log.attributes["esx.event"], "scsi_error")'
          - 'set(log.attributes["scsi.host_status"], log.cache["h"]) where log.cache["h"] != nil'
          - 'set(log.attributes["scsi.device_status"], log.cache["d"]) where log.cache["d"] != nil'
          - 'set(log.attributes["scsi.plugin_status"], log.cache["p"]) where log.cache["p"] != nil'
          - 'set(log.attributes["scsi.sense.key"], log.cache["key"]) where log.cache["key"] != nil'
          - 'set(log.attributes["scsi.sense.asc"], log.cache["asc"]) where log.cache["asc"] != nil'
          - 'set(log.attributes["scsi.sense.ascq"], log.cache["ascq"]) where log.cache["ascq"] != nil'
          - 'set(log.attributes["scsi.command"], log.cache["cmd"]) where log.cache["cmd"] != nil'
          - 'set(log.attributes["storage.device"], log.cache["dev"]) where log.cache["dev"] != nil'
          - 'set(log.attributes["storage.path"], log.cache["path"]) where log.cache["path"] != nil'

      # F. Permanent Device Loss (runs after E so "pdl" wins over "scsi_error")
      - context: log
        conditions:
          - 'IsMatch(log.attributes["message"], "permanently inaccessible|sense data: 0x5 0x25 0x0")'
        statements:
          - 'set(log.attributes["esx.event"], "pdl")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "(?P<dev>(?:naa|eui|t10|mpx)\\.[A-Za-z0-9._:-]+)"), "upsert")'
          - 'set(log.attributes["storage.device"], log.cache["dev"]) where log.cache["dev"] != nil'
          - 'set(log.severity_number, SEVERITY_NUMBER_ERROR)'
          - 'set(log.severity_text, "ERROR")'

      # G. vMotion failures (vmkernel Migrate/VMotion modules, hostd/vpxa task text)
      - context: log
        conditions:
          - 'IsMatch(log.attributes["message"], "(?i)vmotion|migrat")'
        statements:
          - 'set(log.attributes["esx.event"], "vmotion_failure") where IsMatch(log.attributes["message"], "(?i)fail|timed? ?out|exceeded|abort")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "(?:Migrate|VMotion[A-Za-z]*): \\d+: (?P<mid>\\d{10,}) (?P<role>[SD]):"), "upsert")'
          - 'set(log.attributes["vmotion.migration_id"], log.cache["mid"]) where log.cache["mid"] != nil'
          - 'set(log.attributes["vmotion.role"], "source") where log.cache["role"] == "S"'
          - 'set(log.attributes["vmotion.role"], "destination") where log.cache["role"] == "D"'

      # H. User-world crashes, hostd and vpxa in particular
      - context: log
        conditions:
          - 'IsMatch(log.attributes["message"], "wantCoreDump:|Dumping cartel|running on ESXi? host has crashed")'
        statements:
          - 'set(log.attributes["esx.event"], "uw_crash")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "wantCoreDump:(?P<proc>[A-Za-z0-9_.-]+)"), "upsert")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], ": (?P<proc>[A-Za-z0-9_.-]+): Dumping cartel"), "upsert")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "An application \\((?P<proc>[^)]+)\\) running on"), "upsert")'
          - 'merge_maps(log.cache, ExtractPatterns(log.attributes["message"], "(?P<core>/var/core/[^ ]+[0-9])"), "upsert")'
          - 'set(log.attributes["process.executable.name"], log.cache["proc"]) where log.cache["proc"] != nil'
          - 'set(log.attributes["esx.core_file"], log.cache["core"]) where log.cache["core"] != nil'
          - 'set(log.attributes["esx.event"], "hostd_crash") where IsMatch(log.cache["proc"], "hostd")'
          - 'set(log.attributes["esx.event"], "vpxa_crash") where IsMatch(log.cache["proc"], "vpxa")'
          - 'set(log.severity_number, SEVERITY_NUMBER_ERROR)'
          - 'set(log.severity_text, "ERROR")'

      # I. Make the human-readable message the log body and drop header noise
      - context: log
        statements:
          - 'set(log.body, log.attributes["message"]) where log.attributes["message"] != nil'
          - 'delete_key(log.attributes, "message")'
          - 'delete_key(log.attributes, "priority")'
          - 'delete_key(log.attributes, "facility")'
          - 'delete_key(log.attributes, "version")'
          - 'delete_key(log.attributes, "structured_data")'
          - 'delete_key(log.attributes, "vmk_level")'

exporters:
  debug:
    verbosity: basic
  otlp_http/loki:
    endpoint: ${env:LOKI_OTLP_URL}
    sending_queue:
      storage: file_storage/queue
      queue_size: 5000
      batch:
        flush_timeout: 2s
        min_size: 2000
    retry_on_failure:
      enabled: true
      max_elapsed_time: 10m

service:
  extensions: [health_check, file_storage/queue]
  telemetry:
    metrics:
      level: normal
      readers:
        - pull:
            exporter:
              prometheus:
                host: 0.0.0.0
                port: 8888
  pipelines:
    logs/esx:
      receivers: [syslog/esx_3164, syslog/esx_5424]
      processors: [memory_limiter, transform/esx_events]
      exporters: [otlp_http/loki, debug]

Things worth noticing:

  • The operator list is declared once with a YAML anchor (&esx_operators) and reused by the second receiver with *esx_operators.
  • The sending queue is persistent (file_storage/queue), so a Loki restart or a collector restart does not lose what was in flight. Size the disk for the backlog you want to survive; section 13 has the arithmetic.
  • Keep debug with verbosity: basic in the pipeline while you build rules, switch it to detailed to see every attribute, and remove it in production.
  • If you need a UDP listener for devices that cannot do TCP, add a third receiver with udp: {listen_address: 0.0.0.0:5515}, protocol: rfc3164, and the same operators. For high rates, the UDP input has an async block with multiple readers and processors.

10. Sample lines and what they become

These are representative lines as they arrive over RFC 3164 (header, then app name, then message). Module line numbers, pointers and IDs vary by build and are invented here; the shape is what matters. Each row shows the attributes the configuration produces, as printed by the debug exporter in my test run.

Sample line (message part)AppResulting attributes
cpu8:2097215)WARNING: NFS: 1985: Lost connection to the server 10.0.20.50 mount point /vol/ds01, mounted as c3c7f1a2-6b0e4d21-0000-000000000000 ("nfs-ds01")vmkernelesx.event=nfs_disconnect, nfs.server=10.0.20.50, nfs.export=/vol/ds01, vcenter.datastore.name=nfs-ds01, vmk_module=NFS, severity WARN
cpu20:2098012)StorageApdHandlerEv: 110: Device or filesystem with identifier [c3c7f1a2-6b0e4d21] has entered the All Paths Down state.vmkernelesx.event=apd_start, storage.device=c3c7f1a2-6b0e4d21, severity ERROR
[APDCorrelator] 2213454567us: [esx.problem.storage.apd.start] Device or filesystem with identifier [c3c7f1a2-6b0e4d21] has entered the All Paths Down state.vobdesx.vob.id=esx.problem.storage.apd.start, esx.event=apd_start, storage.device=c3c7f1a2-6b0e4d21, severity ERROR
cpu2:2097590)StorageApdHandlerEv: 126: Device or filesystem with identifier [c3c7f1a2-6b0e4d21] has entered the All Paths Down Timeout state after being in the All Paths Down state for 140 seconds. I/Os will now be fast failed.vmkernelesx.event=apd_timeout, storage.device=c3c7f1a2-6b0e4d21, severity ERROR
cpu35:2097965)NMP: nmp_ThrottleLogForDevice:3893: Cmd 0x2a (0x45d8c1a24b48, 2099213) to dev "naa.600a0980383...0c9d" on path "vmhba64:C0:T1:L12" Failed: H:0x0 D:0x2 P:0x0 Valid sense data: 0x6 0x29 0x0. Act:NONEvmkernelesx.event=scsi_error, scsi.command=0x2a, scsi.host_status=0x0, scsi.device_status=0x2, scsi.plugin_status=0x0, scsi.sense.key=0x6, scsi.sense.asc=0x29, scsi.sense.ascq=0x0, storage.device=naa..., storage.path=vmhba64:C0:T1:L12
cpu3:2097590)ScsiDeviceIO: 4325: Cmd(0x45b8c1a2b3c8) 0x28, CmdSN 0x88 from world 0 to dev "naa.600a...0c9d" failed H:0x0 D:0x2 P:0x0 Valid sense data: 0x5 0x25 0x0.vmkernelesx.event=pdl plus all scsi.* fields, severity ERROR
cpu5:2099412)Migrate: 104: 1764497702218316 S: Migration considered a failure by the VMX. It is most likely a timeout, but check the VMX log for the true error.vmkernelesx.event=vmotion_failure, vmotion.migration_id=1764497702218316, vmotion.role=source
[UserWorldCorrelator] 3456789012us: [esx.problem.application.core.dumped] An application (/bin/hostd) running on ESXi host has crashed (1 time(s) so far). A core file may have been created at /var/core/hostd-zdump.000.vobdesx.event=hostd_crash, process.executable.name=/bin/hostd, esx.core_file=/var/core/hostd-zdump.000, esx.vob.id=esx.problem.application.core.dumped, severity ERROR
[Originator@6876 sub=Vimsvc.TaskManager opID=lro-48211-6c1f2a7e user=vpxuser] Task Created : haTask-ha-host-vim.HostSystem.enterMaintenanceMode-8812Hostdvsphere.op_id=lro-48211-6c1f2a7e

Every record also carries resource host.name (lower-cased), service.name=esxi and service.namespace=vsphere, and attributes appname, proc_id where present, and facility_text. In Loki, service.name and service.namespace are on the default list of resource attributes promoted to index labels, so they become service_name and service_namespace. Everything else, host.name included, lands as structured metadata with dots turned into underscores. You therefore select the stream with {service_name="esxi"} and filter with | host_name="esx01.lab.local" | esx_event="apd_start". Part 4 shows how to promote host.name to an index label as well; the pipe form of the query works either way.

11. End-to-end workflow

From nothing to parsed ESXi events in Loki. Each step has a check and the output you should see before moving on.

  1. Install the collector on a Linux VM (RPM or DEB from the opentelemetry-collector-releases page, or the container image otel/opentelemetry-collector-contrib:0.166.0). Check: otelcol-contrib --version. Expected: otelcol-contrib version 0.166.0.
  2. Drop in the configuration from section 09 and set LOKI_OTLP_URL. Check: LOKI_OTLP_URL=http://<LOKI_FQDN>:3100/otlp otelcol-contrib validate --config=file:/etc/otelcol-contrib/config.yaml. Expected: no output and exit code 0.
  3. Open the host firewall on the collector VM for TCP 1514 and 5514 from your ESXi management network, for example firewall-cmd --permanent --add-port=1514/tcp --add-port=5514/tcp && firewall-cmd --reload. Check: ss -ltn | grep -E "1514|5514" after the service starts. Expected: two LISTEN lines.
  4. Start the service: systemctl enable --now otelcol-contrib. Check: curl -s http://127.0.0.1:13133. Expected: {"status":"Server available", ...}.
  5. Prove parsing locally before touching a host: printf '<180>Nov 30 10:15:02 ESX99.lab.local vmkernel: cpu8:2097215)WARNING: NFS: 1985: Lost connection to the server 10.0.20.50 mount point /vol/ds01, mounted as c3c7f1a2-6b0e4d21-0000-000000000000 ("nfs-ds01")\n' | nc -w1 127.0.0.1 1514, then journalctl -u otelcol-contrib -n 50 with the debug exporter at detailed. Expected: a LogRecord with resource host.name: Str(esx99.lab.local) and esx.event: Str(nfs_disconnect).
  6. Configure one host with the script in section 04 using -Cluster scoped to a test cluster, first with -WhatIf. Check: esxcli system syslog config get on the host. Expected: Remote Host: tcp://<COLLECTOR_FQDN>:1514 (plus any existing targets).
  7. Confirm the TCP session from the host: esxcli network ip connection list | grep 1514. Expected: one ESTABLISHED connection owned by vmsyslogd.
  8. Find the marker in Loki: in Grafana Explore, run {service_name="esxi"} |= "otel-syslog-check". Expected: one line per log stream on that host within a few seconds, each with host_name among its fields.
  9. Check the collector’s own counters: curl -s http://127.0.0.1:8888/metrics | grep -E "otelcol_receiver_accepted_log_records|otelcol_exporter_sent_log_records|otelcol_exporter_send_failed_log_records". Expected: accepted and sent climbing together, send_failed at zero.
  10. Roll out to the remaining clusters with the script, review the CSV report for any failed rows, and remove the debug exporter from the pipeline. Check: sum by (host_name) (count_over_time({service_name="esxi"}[5m])) in Explore. Expected: one series per host, none at zero.

12. Troubleshooting

SymptomLikely causeCheckFix
Nothing arrives from a hostSyslog firewall ruleset disabled, or logHost not appliedesxcli network firewall ruleset list --ruleset-id=syslog; esxcli system syslog config getEnable the ruleset, esxcli network firewall refresh, esxcli system syslog reload
Works on 8.0 U3, nothing from 8.0 U1 or 7.x on port 5514Non-standard port and no dynamic firewall rule before 8.0 U2b; or the 7.x parser rejecting the query string/var/log/.vmsyslogd.err; an invalid port error in hostd.logUse tcp://<COLLECTOR>:1514 with the default RFC 3164 formatter for those hosts
Collector fails to start: bind permission deniedListening on 514, a privileged port, as a non-root userjournalctl -u otelcol-contribListen on 1514, or grant CAP_NET_BIND_SERVICE; for rootless Podman lower net.ipv4.ip_unprivileged_port_start
Records arrive but have no appname, body is the raw lineRFC mismatch: 5424 sent to a 3164 listener or the reverse; or a strict 5424 parse failureDebug exporter at detailed; set receiver on_error: send temporarily to see the parse errorMatch formatter to the listener; fall back to RFC 3164 for builds with non-conforming 5424
Several messages glued into one record, or one message splitFraming mismatch: octet_counting on one side onlyLook for a leading number such as 233 <166>1 in the bodySet framing=octet_counting on the host and enable_octet_counting: true on the receiver, together
Timestamps off by whole hoursRFC 3164 has no time zone and location is not UTC, or the host clock is wrongCompare record time with esxcli system time getlocation: UTC; fix NTP on the host; prefer RFC 5424, which carries a zone
Events around New Year land in the wrong yearRFC 3164 has no year; the receiver infers itLook at records sent on 31 December and read on 1 JanuaryRFC 5424 removes the ambiguity
Long lines cut off at about 1 KBSyslog.global.remoteHost.maxMsgLen default of 1 KiBesxcli system syslog config getRaise to 4096 or more (max 16 KiB); check every relay in between accepts it
vmkernel messages split into two lines, second half unparsedvmkernel wraps entries longer than 256 characters (Broadcom KB, no workaround)Second line lacks the cpuN:world) prefixMatch on the first line; do not rely on text after the wrap
Gaps during storage incidentsUDP loss, or the host queue hitting its drop mark/var/run/log/vmsyslogd-dropped.log on the hostMove to TCP; investigate collector back-pressure and exporter queue
logHost changes back on its ownvSphere Configuration Profiles remediation, or VCF Operations for Logs integrationHost events for advanced setting changesSet syslog in the owning system and append, do not replace
Loki shows service_name="unknown_service"service.name missing from the resourceDebug exporter: is it under Resource attributes?Check the add operator; it must target resource["service.name"]
Same host appears as ESX01 and esx01.lab.localMixed hostname settings across hosts or formatssum by (host_name)(count_over_time({service_name="esxi"}[1h]))Lower-case in the operator (already done); normalise short versus FQDN as shown in part 4
APD counted three times per eventvmkernel, vmkwarning and vobd all log it| esx_event="apd_start" grouped by appnameAlert on > 0, or count only appname="vobd"

13. Running it at scale

ESXi log volume depends far more on what is happening than on host count: a quiet host may send a line every few seconds, a host with a flapping path can send hundreds per second. Measure rather than guess. sum(rate(otelcol_receiver_accepted_log_records[5m])) from the collector’s own metrics gives you records per second, and a week of that tells you the peak to size for.

  • One gateway handles a lot. Syslog parsing plus a dozen OTTL groups is cheap per record. Two collectors behind a TCP load balancer give you availability; a TCP balancer distributes connections, not messages, so each host sticks to one collector until its connection resets.
  • Size the persistent queue for the outage you want to ride through. If the estate peaks at 2,000 records per second at roughly 300 bytes each, an hour of Loki downtime is about 2.2 GB of queue. Set queue_size and the disk accordingly.
  • Do not make high-cardinality fields into Loki labels. storage.device, vsphere.op_id and vmk_world are perfect as structured metadata and terrible as labels. This build adds no index labels beyond Loki’s defaults (service_name, service_namespace). If you promote host_name as part 4 does, it is bounded by your host count, which is fine.
  • Drop what you will never read. A filter processor before the exporter can drop known chatty lines, for example verbose hostd debug from a misbehaving plugin, before they cost storage.

Once logs and metrics share a host name, the obvious next move is to put them on the same screen and alert on both. If you prefer to read logs offline after the fact, the ESXi log analyser post covers that workflow.


What’s next

Part 4 stands up Prometheus, Loki, Tempo and Grafana with provisioning, explains how OpenTelemetry names turn into Prometheus and Loki names, and joins these logs to the vCenter metrics from part 2 on the host name, with alert rules for APD, latency, CPU ready and datastore space. For a deeper treatment of the APD rule as an early warning, see catching NFS APD before vCenter does, and to generate the collector and host configuration from inventory instead of by hand, see generating OTel collector configs with PowerCLI. If you are starting here, part 1 explains where OpenTelemetry fits next to VCF Operations.

Tested with otelcol-contrib 0.166.0 against synthetic ESXi 8 style lines in RFC 3164 and RFC 5424 format. Syslog option names are from the Broadcom vSphere 8.0 and 9.0 documentation. Line wording differs between ESXi builds, so validate each rule against your own hosts’ logs before you alert on it.

One response

Leave a Reply