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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...