Skip to content

Instantly share code, notes, and snippets.

@aoirint
Created February 8, 2023 14:35
Show Gist options
  • Save aoirint/137cff3217d5823b50f9ac056d6301e2 to your computer and use it in GitHub Desktop.
Save aoirint/137cff3217d5823b50f9ac056d6301e2 to your computer and use it in GitHub Desktop.
既存のentrypointを置き換えてubuntu/bind9のログを永続化するシェルスクリプト
#!/bin/bash
set -e
{
/usr/local/bin/docker-entrypoint.sh $@
} \
1> >(tee -a >(sed -u "s/^/[$(date -Ins)] /" >> /bind_logs/named_stdout.log) >&1) \
2> >(tee -a >(sed -u "s/^/[$(date -Ins)] /" >> /bind_logs/named_stderr.log) >&2)
@aoirint
Copy link
Author

aoirint commented Feb 8, 2023

Q. 秒以下と秒の区切りが,になっているのを.にできませんか?

GNU dateが区切りを,にすることが原因ですが、変更するオプションはありません。個人的には,にはなじみがないけれど、ISO 8601的には,の方が推奨らしい(ISO文書のAbstractにある例も.になってるけど、ほんとか??)。

ISO原典読むの5万くらいする(166 + 187 CHF = 353 CHF ~ 50000 JPY)らしいのでWikipediaで許して...(RFC 3339を読めばいいのかもしれないけど)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment