Stackdriver 'always free' logging on an Ubuntu 18.04 GCP VM
Google Cloud ‘Always free products’ currently lists:
50 GB of logs with 30-day retention read access API
Setting up Logging
# Add a google-fluentd repository:
# download installation script
curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
# look over installation script and execute when satisfied
less add-logging-agent-repo.sh
sudo bash add-logging-agent-repo.sh
# update apt repositories
sudo apt-get update
# list the versions of the logging agent available
sudo apt-cache madison google-fluentd
# install a specific version of the agent
sudo apt-get install -y 'google-fluentd=1.6.*'
# install a catch-all configuration
sudo apt-get install -y google-fluentd-catch-all-config-structured
# start the service
sudo service google-fluentd start
# Check google-fluentd is running
service google-fluentd status
With the service running, check out the agent log to see what is going on:
cat /var/log/google-fluentd/google-fluentd.log
# evidence of successful remote centralised logging
[info]: Successfully sent gRPC to Stackdriver Logging API.
# enable logging-agent start at boot
systemctl enable google-fluentd
With the client side looking ok, log into Google Cloud Platform and have a click around. I noticed an issue in logs:
“Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.”
This is due to systemd-resolved being skipped due to a default symlink configuration.
ls -alh /etc/resolv.conf
# /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
sudo ln -sfn /run/systemd/resolve/resolv.conf /etc/resolv.conf
ls -alh /etc/resolv.conf
# /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
With the symlink updated, the logging output looks clean, aside from Ubuntu adverts:
Starting Message of the Day…
Kubernetes 1.18 GA is now available! See https://microk8s.io for docs or