Splunk Search

regex問題のトラブルシューティング方法について

cwl
Contributor

以下のサーチ文で、regexreplacementプロセッサーがかなりのCPUリソースを使用していることまではわかりましたが、どのように問題のREGEXを特定できますでしょうか。

index=_internal source=*metrics.log* group=pipeline name=typing | timechart limit=50 span=1h per_hour(cpu_seconds) by processor

例えば、どのsourcetypeやhostなどからのREGEXがCPUを使っているかを特定する方法はありますでしょうか。

0 Karma
1 Solution

cwl
Contributor

Splunk Enterprise 6.6 および 7.0 から、limits.conf に以下のパラメータが追加されました。

regex_cpu_profiling = <bool>
* Enable CPU time metrics for RegexProcessor. Output will be in the 
  metrics.log file.
  Entries in metrics.log will appear per_host_regex_cpu, per_source_regex_cpu,
  per_sourcetype_regex_cpu, per_index_regex_cpu.
* Default: false

regex_cpu_profiling を true に設定し、splunk を再起動することにより、metrics.log に per_host_regex_cpu、per_source_regex_cpu、per_sourcetype_regex_cpu、per_index_regex_cpu のような情報が追加されます。
そして、以下のサーチ文を使うことにより、どの sourcetype がもっとも CPU リソースを使用しているかを確認することができます。

index=_internal host=<調査対象ホストサーバ> source=*metrics.log* group=per_sourcetype_regex_cpu | timechart max(cpu) by series

また、以下のサーチ文を使うことにより、event 毎にどの sourcetype がもっとも CPU リソースを使用しているかを確認することができます。

index=_internal host=<調査対象ホストサーバ> source=*metrics.log* group=per_sourcetype_regex_cpu | timechart max(cpupe) by series

なお、デフォルトでは、もっともCPUリソースを使用する上位の10 sourceytypeしかmetrics.logに記録されず、10より多くのsourcetypeを記録したい場合は、記録したい数をmaxseriesに設定する必要があります。

[metrics]
maxseries = <integer>
* The number of series to include in the per_x_thruput reports in metrics.log.
* Default: 10

View solution in original post

cwl
Contributor

Splunk Enterprise 6.6 および 7.0 から、limits.conf に以下のパラメータが追加されました。

regex_cpu_profiling = <bool>
* Enable CPU time metrics for RegexProcessor. Output will be in the 
  metrics.log file.
  Entries in metrics.log will appear per_host_regex_cpu, per_source_regex_cpu,
  per_sourcetype_regex_cpu, per_index_regex_cpu.
* Default: false

regex_cpu_profiling を true に設定し、splunk を再起動することにより、metrics.log に per_host_regex_cpu、per_source_regex_cpu、per_sourcetype_regex_cpu、per_index_regex_cpu のような情報が追加されます。
そして、以下のサーチ文を使うことにより、どの sourcetype がもっとも CPU リソースを使用しているかを確認することができます。

index=_internal host=<調査対象ホストサーバ> source=*metrics.log* group=per_sourcetype_regex_cpu | timechart max(cpu) by series

また、以下のサーチ文を使うことにより、event 毎にどの sourcetype がもっとも CPU リソースを使用しているかを確認することができます。

index=_internal host=<調査対象ホストサーバ> source=*metrics.log* group=per_sourcetype_regex_cpu | timechart max(cpupe) by series

なお、デフォルトでは、もっともCPUリソースを使用する上位の10 sourceytypeしかmetrics.logに記録されず、10より多くのsourcetypeを記録したい場合は、記録したい数をmaxseriesに設定する必要があります。

[metrics]
maxseries = <integer>
* The number of series to include in the per_x_thruput reports in metrics.log.
* Default: 10
Get Updates on the Splunk Community!

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...