1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cloudflared tunnel のログ出力オプション

Posted at

cloudflared (Cloudflare Tunnel) には、サポート問い合わせ用途でログ出力オプションが用意されている。

How do I contact support?

ログ関連のオプション

   --loglevel value                                    Application logging level {debug, info, warn, error, fatal}. At debug level cloudflared will log request URL, method, protocol, content length, as well as, all request and response headers. This can expose sensitive information in your logs. (default: "info") [$TUNNEL_LOGLEVEL]
   --transport-loglevel value, --proto-loglevel value  Transport logging level(previously called protocol logging level) {debug, info, warn, error, fatal} (default: "info") [$TUNNEL_PROTO_LOGLEVEL, $TUNNEL_TRANSPORT_LOGLEVEL]
   --logfile value                                     Save application log to this file for reporting issues. [$TUNNEL_LOGFILE]
   --log-directory value                               Save application log to this directory for reporting issues. [$TUNNEL_LOGDIRECTORY]

オプション指定による挙動の違い

Version 2024.5.0 で確認。

デフォルト(オプション未指定)

  • 標準出力
tunnel --no-autoupdate --hello-world

--logfile

  • 標準出力+指定したログファイルに出力
  • ログローテーションは 行われない
tunnel --no-autoupdate --hello-world --logfile /var/log/cloudflared/cloudflared.log

--log-directory

  • 標準出力+指定したディレクトリに cloudflared.log を出力
  • ログローテーションが行われる
    • 1MiB 毎に以下のファイル名にローテーションされ、 5ファイル保持
    • cloudflared-YYYY-MM-DDTHH-MM-SS.sss.log
cloudflared tunnel --no-autoupdate --hello-world --log-directory /var/log/cloudflared

コード上定義箇所

# https://github.com/cloudflare/cloudflared/blob/master/logger/configuration.go#L40
	const RollingMaxSize = 1    // Mb
	const RollingMaxBackups = 5 // files
	const RollingMaxAge = 0     // Keep forever
	const defaultLogFilename = "cloudflared.log"
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?