Last active
January 24, 2023 07:06
-
-
Save froop/f229308cb12aa71dd09bf08f686cffa1 to your computer and use it in GitHub Desktop.
Revisions
-
froop revised this gist
Jun 7, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ [rsyslog] メッセージ出力のタイミングが遅延する ============ 事象 ------------ rsyslog パッケージの omfwd モジュールにより、TCP ベースの syslog 転送 [^1] が発生した際に、ソケットから制御が戻るまでの間、他のアクションでも出力が待たされる(最大で数分)。 例えば、デフォルトの /etc/rsyslog.conf の場合、下記ファイルへの出力が遅延する。 * /var/log/messages -
froop revised this gist
Jun 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,7 +44,7 @@ RHEL7 のデフォルトでは、TCP接続確立のリトライは 6 回(`net. 原因 ------------ TCP転送アクション [^1] にキューがないために、メッセージを非同期的に処理できず?、他アクションも巻き込まれる。 ### 参考 第23章 ログファイルの表示と管理 Red Hat Enterprise Linux 7 | Red Hat Customer Portal -
froop revised this gist
Jun 6, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,10 +35,10 @@ https://access.redhat.com/solutions/1594173 ------------ omfwd モジュールを使用して TCP 通信を行うアクションが、キューなし(デフォルトの `$ActionQueueType Direct`)の場合。 具体的には、/etc/rsyslog.conf に転送設定 [^1] のみを追加し、アクションキュー設定を追加していない場合。 特に影響が大きいのが、TCP 接続の確立要求(3 ウェイハンドシェイクの SYN パケット)に応答がなく、タイムアウトまで待機する場合。 RHEL7 のデフォルトでは、TCP接続確立のリトライは 6 回(`net.ipv4.tcp_syn_retries = 6`)のため、合計で 2 分強も遅延する。 なお、相手ホストが存在しない場合でも、ルータから ICMP(Type 3: destination unreachable)が返るならば発生しない。 -
froop revised this gist
Jun 6, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ [rsyslog] メッセージ出力のタイミングが遅延する(最大数分) ============ 事象 @@ -14,7 +14,7 @@ rsyslog パッケージの omfwd モジュールにより、TCP ベースの sys * /var/log/spooler * /var/log/boot.log また、遅延している間に下記状況となった場合、メッセージが出力されないまま破棄される。 * rsyslog サービスが停止 * メインメッセージキューのサイズ($MainMsgQueueSize: デフォルト100000)を超過 @@ -26,7 +26,7 @@ https://blog.orz.at/2018/06/17/rsyslog/ Slow ssh while rsyslog forwarding system logs via TCP - Red Hat Customer Portal https://access.redhat.com/solutions/1594173 [^1]: /etc/rsyslog.conf [^2] のルール設定にて、出力先として "@@host:port" (先頭に「@」2つ)の形式で指定したもの。例えば `*.* @@remote-host:514` [^2]: または /etc/rsyslog.d 配下のファイル -
froop revised this gist
Jun 6, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ [rsyslog] メッセージ出力のタイミングが大きく(最大数分)遅延する ============ 事象 ------------ rsyslog パッケージの omfwd モジュールにより、TCP ベースの syslog 転送 [^1] が発生した際に、ソケットから制御が戻るまでの間、他のアクションでも出力が待たされる。 例えば、デフォルトの /etc/rsyslog.conf の場合、下記ファイルへの出力が遅延する。 * /var/log/messages -
froop revised this gist
Jun 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ rsyslog パッケージの omfwd モジュールにより、TCP ベースの sys また、遅延している間に下記状況となった場合、メッセージを喪失する。 * rsyslog サービスが停止 * メインメッセージキューのサイズ($MainMsgQueueSize: デフォルト100000)を超過 場合によっては、入力側も詰まることがある模様。 -
froop revised this gist
Jun 6, 2021 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,11 @@ rsyslog パッケージの omfwd モジュールにより、TCP ベースの sys * /var/log/spooler * /var/log/boot.log また、遅延している間に下記状況となった場合、メッセージを喪失する。 * rsyslog サービスが停止 * メインメッセージキューのサイズ($MainMsgQueueSize: デフォルト50000)を超過 場合によっては、入力側も詰まることがある模様。 rsyslogで処理が詰まらないようにする | たむたむの日記 -
froop revised this gist
Jun 6, 2021 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,8 +15,11 @@ rsyslog パッケージの omfwd モジュールにより、TCP ベースの sys * /var/log/boot.log 場合によっては、入力側も詰まることがある模様。 rsyslogで処理が詰まらないようにする | たむたむの日記 https://blog.orz.at/2018/06/17/rsyslog/ Slow ssh while rsyslog forwarding system logs via TCP - Red Hat Customer Portal https://access.redhat.com/solutions/1594173 [^1]: /etc/rsyslog.conf [^2] の RULES 設定にて、出力先として "@@host:port" 形式で指定したもの。例えば `*.* @@remote-host:514` -
froop revised this gist
Jun 6, 2021 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,8 +14,7 @@ rsyslog パッケージの omfwd モジュールにより、TCP ベースの sys * /var/log/spooler * /var/log/boot.log 場合によっては、入力側も詰まることがある模様。 rsyslogで処理が詰まらないようにする | たむたむの日記 https://blog.orz.at/2018/06/17/rsyslog/ -
froop revised this gist
Jun 6, 2021 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,11 @@ rsyslog パッケージの omfwd モジュールにより、TCP ベースの sys * /var/log/spooler * /var/log/boot.log 場合によっては、入力側も詰まることがある様です。 rsyslogで処理が詰まらないようにする | たむたむの日記 https://blog.orz.at/2018/06/17/rsyslog/ [^1]: /etc/rsyslog.conf [^2] の RULES 設定にて、出力先として "@@host:port" 形式で指定したもの。例えば `*.* @@remote-host:514` [^2]: または /etc/rsyslog.d 配下のファイル -
froop revised this gist
Jun 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,7 @@ RHEL7 のデフォルトでは、TCP接続確立のリトライは6回(`net.ip 原因 ------------ TCP転送アクション [^1] にキューがないために、メッセージを非同期に処理できず(前段階のメインメッセージキューが次へ進めず?)、他アクションも巻き込まれる。 ### 参考 第23章 ログファイルの表示と管理 Red Hat Enterprise Linux 7 | Red Hat Customer Portal -
froop revised this gist
Jun 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ rsyslog パッケージの omfwd モジュールにより、TCP ベースの sys ------------ omfwd モジュールを使用して TCP 通信を行うアクションが、キューなし(デフォルトの `$ActionQueueType Direct`)の場合。 具体的には、/etc/rsyslog.conf に転送設定 [^1] のみを追加し、アクションキュー設定を追加しない場合。 特に影響が大きいのが、TCP 接続の確立要求(3ウェイハンドシェイクの SYN パケット)に応答がなく、タイムアウトまで待機する場合。 RHEL7 のデフォルトでは、TCP接続確立のリトライは6回(`net.ipv4.tcp_syn_retries = 6`)のため、合計で2分強も遅延する。 -
froop revised this gist
Jun 6, 2021 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,6 +34,11 @@ RHEL7 のデフォルトでは、TCP接続確立のリトライは6回(`net.ip ------------ TCP転送アクション [^1] にキューがないために、メッセージを非同期に処理できず(メインメッセージキューが次へ進めず?)、他アクションも巻き込まれる。 ### 参考 第23章 ログファイルの表示と管理 Red Hat Enterprise Linux 7 | Red Hat Customer Portal 23.4. Rsyslog でのキュー (Queue) を使った操作 https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-viewing_and_managing_log_files#s1-working_with_queues_in_rsyslog 対処方法 ------------ @@ -58,9 +63,4 @@ TCP転送アクション [^1] にキューがないために、メッセージ # remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional #*.* @@remote-host:514 # ### end of the forwarding rule ### ``` -
froop revised this gist
Jun 6, 2021 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,4 +58,9 @@ TCP転送アクション [^1] にキューがないために、メッセージ # remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional #*.* @@remote-host:514 # ### end of the forwarding rule ### ``` ### 参考 第23章 ログファイルの表示と管理 Red Hat Enterprise Linux 7 | Red Hat Customer Portal 23.4. Rsyslog でのキュー (Queue) を使った操作 https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-viewing_and_managing_log_files#s1-working_with_queues_in_rsyslog -
froop revised this gist
Jun 6, 2021 . 1 changed file with 30 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ 事象 ------------ rsyslog パッケージの omfwd モジュールにより、TCP ベースの syslog 転送 [^1] が発生した際に、ソケットから制御が戻るまでの間、他のアクションでも出力が遅延する。 例えば、デフォルトの /etc/rsyslog.conf の場合、下記ファイルへの出力が遅延する。 * /var/log/messages @@ -14,26 +14,48 @@ rsyslog パッケージの omfwd モジュールによる TCP 通信 [^1] が発 * /var/log/spooler * /var/log/boot.log [^1]: /etc/rsyslog.conf [^2] の RULES 設定にて、出力先として "@@host:port" 形式で指定したもの。例えば `*.* @@remote-host:514` [^2]: または /etc/rsyslog.d 配下のファイル 発生条件 ------------ omfwd モジュールを使用して TCP 通信を行うアクションが、キューなし(デフォルトの `$ActionQueueType Direct`)の場合。 例えば、/etc/rsyslog.conf に転送設定 [^1] のみを追加し、アクションキュー設定を追加しない場合。 特に影響が大きいのが、TCP 接続の確立要求(3ウェイハンドシェイクの SYN パケット)に応答がなく、タイムアウトまで待機する場合。 RHEL7 のデフォルトでは、TCP接続確立のリトライは6回(`net.ipv4.tcp_syn_retries = 6`)のため、合計で2分強も遅延する。 なお、相手ホストが存在しない場合でも、ルータから ICMP(Type 3: destination unreachable)が返るならば発生しない。 原因 ------------ TCP転送アクション [^1] にキューがないために、メッセージを非同期に処理できず(メインメッセージキューが次へ進めず?)、他アクションも巻き込まれる。 対処方法 ------------ /etc/rsyslog.conf [^2] への転送設定 [^1] の追加に合わせて、アクションキュー(例: `$ActionQueueType LinkedList`)も追加する。 /etc/rsyslog.conf には、転送ルールの例として下記の記載がある。 ``` # ### begin forwarding rule ### # The statement between the begin ... end define a SINGLE forwarding # rule. They belong together, do NOT split them. If you create multiple # forwarding rules, duplicate the whole block! # Remote Logging (we use TCP for reliable delivery) # # An on-disk queue is created for this action. If the remote host is # down, messages are spooled to disk and sent when it is up again. #$ActionQueueFileName fwdRule1 # unique name prefix for spool files #$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible) #$ActionQueueSaveOnShutdown on # save messages to disk on shutdown #$ActionQueueType LinkedList # run asynchronously #$ActionResumeRetryCount -1 # infinite retries if host is down # remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional #*.* @@remote-host:514 # ### end of the forwarding rule ### ``` -
froop revised this gist
Jun 6, 2021 . 1 changed file with 11 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ [rsyslog] メッセージ出力が大きく(最大数分)遅延する ============ 事象 ------------ rsyslog パッケージの omfwd モジュールによる TCP 通信 [^1] が発生した際に、ソケットから制御が戻るまでの間、他のアクションでも出力が遅延する。 例えば、デフォルトの /etc/rsyslog.conf の場合、下記ファイルへの出力が遅延する。 * /var/log/messages @@ -19,14 +19,21 @@ rsyslog パッケージの omfwd モジュールによる TCP 通信(例: `*.* ------------ omfwd モジュールを使用して TCP 通信を行うアクションが、キューなし(デフォルトの `$ActionQueueType Direct`)の場合。 例えば、/etc/rsyslog.conf(または /etc/rsyslog.d 配下のファイル)に転送設定 [^1] のみを追加し、アクションキュー設定を追加しない場合。 特に影響が大きいのが、TCP 接続の確立要求(3ウェイハンドシェイクの SYN パケット)に応答がなく、タイムアウトまで待機する場合。 RHEL7 のデフォルトでは、リトライは6回(`net.ipv4.tcp_syn_retries=6`)のため、合計で2分強も遅延する。 なお、相手ホストが存在しない場合でも、ルータから ICMP(destination unreachable)が返るならば発生しない。 原因 ------------ TCP転送アクション [^1] にキューがないために、非同期に処理できず?(メインメッセージキューが次へ進めず?)、他アクションも巻き込まれる。 対処方法 ------------ /etc/rsyslog.conf(または /etc/rsyslog.d 配下のファイル)への転送設定 [^1] の追加に合わせて、アクションキュー(例: `$ActionQueueType LinkedList`)も追加する。 [^1]: 例: `*.* @@remote-host:514` -
froop revised this gist
Jun 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,4 +29,4 @@ RHEL7 のデフォルトでは、リトライは6回(`net.ipv4.tcp_syn_retries 対処方法 ------------ /etc/rsyslog.conf(または /etc/rsyslog.d 配下のファイル)への転送設定(例: `*.* @@remote-host:514`)の追加に合わせて、アクションキュー(例: `$ActionQueueType LinkedList`)も追加する。 -
froop created this gist
Jun 6, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ [rsyslog] TCP転送アクションが遅延すると、他アクションまで巻き込まれる ============ 事象 ------------ rsyslog パッケージの omfwd モジュールによる TCP 通信(例: `*.* @@remote-host:514`)が発生した際に、ソケットから制御が戻るまでの間、他のアクションでも出力が遅延する。 例えば、デフォルトの /etc/rsyslog.conf の場合、下記ファイルへの出力が遅延する。 * /var/log/messages * /var/log/secure * /var/log/maillog * /var/log/cron * /var/log/spooler * /var/log/boot.log 発生条件 ------------ omfwd モジュールを使用して TCP 通信を行うアクションが、キューなし(デフォルトの `$ActionQueueType Direct`)の場合。 例えば、/etc/rsyslog.conf(または /etc/rsyslog.d 配下のファイル)に転送設定(例: `*.* @@remote-host:514`)のみを追加し、アクションキュー設定を追加しない場合。 特に影響が大きいのが、TCP 接続の確立要求(3ウェイハンドシェイクの SYN パケット)に応答がなく、タイムアウトまで待機する場合。 RHEL7 のデフォルトでは、リトライは6回(`net.ipv4.tcp_syn_retries=6`)のため、合計で2分強も遅延する。 なお、相手ホストが存在しない場合でも、ルータから ICMP(destination unreachable)が返るならば発生しない。 対処方法 ------------ /etc/rsyslog.conf(または /etc/rsyslog.d 配下のファイル)への転送設定(例: `*.* @@remote-host:514`)の追加に合わせて、アクションキュー(例: $ActionQueueType LinkedList)も追加する。