GitHub user jmsperu added a comment to the discussion: Virtual Router to output 
logs to Cloudstack Mgmt Server, so Operator can monitor via Zabbix, Loki or 
other system

This can be done today without code changes, since 4.22.0 (PR #11654, user data 
for system VMs): set systemvm.userdata.enabled=true and point 
virtual.router.userdata (and the console proxy and secondary storage VM 
equivalents) at a registered user data that drops a file in /etc/rsyslog.d/ 
with a forward rule (for example `*.* @@logserver:514`) and restarts rsyslog. 
The router picks it up when it is recreated.

Checked in a lab on 4.22.1.1 (KVM): registered a user data with this 
cloud-config, set systemvm.userdata.enabled=true and 
`virtual.router.userdata=<its ID>`, then restarted the network with cleanup so 
a new router was built.

```
#cloud-config
write_files:
  - path: /etc/rsyslog.d/90-central.conf
    content: |
      *.* @10.63.1.10:514
runcmd:
  - systemctl restart rsyslog
```

Result: the new router had the file, rsyslog was active, /var/log/cloud.log on 
the router showed "User data detected ... Cloud-init executed successfully", 
and the log server received the router's lines (229 in the first minute, 
including a test line written with `logger` on the router). Only the virtual 
router was tested, not the console proxy or secondary storage VM, and only UDP 
forwarding.


GitHub link: 
https://github.com/apache/cloudstack/discussions/10165#discussioncomment-19839796

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to