NLnetLabs / krillmanager

Layered infrastructure as code for running Krill as a highly available scalable service with integration points for monitoring and log analysis.
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

RFC trail log uploader error: rfc8181_repo does not exist #29

Closed ximon18 closed 4 years ago

ximon18 commented 4 years ago
# krillmanager --version
v0.1.4 [Krill: v0.5.0]
{
    "hostname": "**********",
    "source": "journal",
    "syslog_id": "ea80c49f1871",
    "ts_epoch_ms": "1587042000549335",
    "container": "krill_rfc_trail_uploader.1.pqfqk6j8a4t5xk6w3l4u2m8a7",
    "message": "crond: USER root pid  21 cmd s3cmd --config=/mnt/conf/s3cmd.conf sync -r --skip-existing /mnt/data/rfc6492 /mnt/data/rfc8181_repo /mnt/data/rfc8181_sent s3://**********/logs/rfc_trail/",
    "image": "krillmanager/log-uploader:v0.1.0@sha256:f6300bc208f9f7e790e838591cf1ce1802204550a3fb53ef2707beac97350d41"
}
{
    "hostname": "**********",
    "source": "journal",
    "syslog_id": "ea80c49f1871",
    "ts_epoch_ms": "1587042000736776",
    "container": "krill_rfc_trail_uploader.1.pqfqk6j8a4t5xk6w3l4u2m8a7",
    "message": "ERROR: Parameter problem: Invalid source: '/mnt/data/rfc8181_repo' is not an existing file or directory",
    "image": "krillmanager/log-uploader:v0.1.0@sha256:f6300bc208f9f7e790e838591cf1ce1802204550a3fb53ef2707beac97350d41"
}

With:

# ls -la krill-data/
total 72
drwxr-xr-x  8 1012 1012 4096 Apr 16 10:16 .
drwxr-xr-x 16 root root 4096 Apr 16 10:12 ..
drwxr-xr-x  3 root root 4096 Apr 16 10:13 cas
drwxr-xr-x  2 root root 4096 Apr 16 10:16 keys
-rw-r--r--  2 1012 1012   76 Feb 25 10:03 krill.conf
drwxr-xr-x  3 root root 4096 Apr 16 10:13 pubd
drwxr-xr-x  4 root root 4096 Apr 16 10:13 repo
drwxr-xr-x  3 root root 4096 Apr 16 10:16 rfc6492
drwxr-xr-x  2 root root 4096 Apr 16 10:13 ssl

Why did it fail, and what is the right way to being to this the attention if the administrator? Detect the error with FluentD and send an email/other notification? Expose Prometheus metrics for Krill manager including rfc trail upload error stats?

ximon18 commented 4 years ago

rfc8181_repo is the directory name mentioned in the Krill v0.5.0 source code, so presumably in this case it simply didn't yet get created by Krill and we should not fail if it does not exist?

ximon18 commented 4 years ago

Testing s3cmd sync with non-existing source directories indeed fails with:

# s3cmd sync -r --skip-existing /tmp/s2 s3://some-bucket/deleteme/
ERROR: Parameter problem: Invalid source: '/tmp/s2' is not an existing file or directory

One workaround is to use regular expression includes, e.g.:

Source directory missing:
# s3cmd sync -r --skip-existing --rexclude '.+' --rinclude '^s2/.+' /tmp/ s3://bucket-name/deleteme/

Source directory present but empty:
# mkdir /tmp/s2
# s3cmd sync -r --skip-existing --rexclude '.+' --rinclude '^s2/.+' /tmp/ s3://bucket-name/deleteme/

Source directory present and contains a file:
# echo blah > /tmp/s2/blah.txt
# s3cmd sync -r --skip-existing --rexclude '.+' --rinclude '^s2/.+' /tmp/ s3://bucket-name/deleteme/
upload: '/tmp/s2/blah.txt' -> 's3://bucket-name/deleteme/s2/blah.txt'  [1 of 1]
 5 of 5   100% in    0s   155.33 B/s  done
Done. Uploaded 5 bytes in 1.0 seconds, 5.00 B/s.

Destination verification:
# s3cmd ls -r s3://bucket-name/deleteme/
2020-04-20 11:53         5   s3://bucket-name/deleteme/s2/blah.txt
ximon18 commented 4 years ago

Testing was successful: image