<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 営業日・時間内のイベントのみカウント in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230165#M175901</link>
    <description>&lt;P&gt;①ですが、Splunkの_timeは１つです。１つのログにはどちらかしか設定できません。どちらですか？または全く違う時刻が設定されていますか？ログのイメージが提示できるのならお願いします。&lt;BR /&gt;
※date_wdayは_timeの値で設定されます。&lt;/P&gt;

&lt;P&gt;②ですが、日をまたぐと計算も複雑になりますが、受付日時から完了日時までの9:00-18:00（土日を除く）間の時間を集計するでいいですか？&lt;/P&gt;

&lt;P&gt;③ですが、土日に受け付けて完了日時が平日の場合でも対象外になりますがそれでいいですか？&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 12:29:41 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2020-09-29T12:29:41Z</dc:date>
    <item>
      <title>営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230156#M175892</link>
      <description>&lt;P&gt;現在、ヒストグラムにて業務の対応時間を集計しています。&lt;BR /&gt;
実働時間の記載がないデータのため、２つの時間項目(受付日時　対応完了日時)を使用して対応時間を算出しております。&lt;BR /&gt;
ですが、現状算出されるデータは受付日時と対応完了日時が土日以外の曜日で9-18の間にタイムスタンプが押されているイベントを取ってくるだけで、営業時間外の時間も対応工数として集計してしまっています。&lt;BR /&gt;
できれば、該当イベントの営業時間内のみ対応工数として時間集計をして欲しいのです。&lt;BR /&gt;
どのように設定すればよいでしょうか。&lt;BR /&gt;
ご教示頂けますよう、よろしくお願いします。&lt;/P&gt;

&lt;P&gt;searchは以下の様になっております。&lt;/P&gt;

&lt;P&gt;【search文】&lt;BR /&gt;
index=問合せ対応_index&lt;BR /&gt;
|eval tnow=now(),受付=strptime('受付日時',"%Y/%m/%d %H:%M"),期限=strptime('対応完了日時',"%Y/%m/%d %H:%M")&lt;BR /&gt;
|where (date_wday="saturday" OR date_wday="sunday")&lt;BR /&gt;
|eval myHour=strftime(_time, "%H") &lt;BR /&gt;
|eval myMinute=strftime(_time, "%M") &lt;BR /&gt;
|where ( (myHour &amp;gt;= 9 AND myMinute &amp;gt;= 00) OR (myHour &amp;lt;= 18 AND myMinute &amp;lt;= 00) )&lt;BR /&gt;
|eval 対応時間=('期限'-'受付')/3600&lt;BR /&gt;
|eval 対応時間(H)=round('対応時間')&lt;BR /&gt;
|search 対応時間&amp;lt;610&lt;BR /&gt;
|search 対応時間&amp;gt;0&lt;BR /&gt;
|bucket 対応時間(H) span=10&lt;BR /&gt;
|stats count as 問合せ件数 by 対応時間(H) &lt;BR /&gt;
|sort 対応時間(H)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:23:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230156#M175892</guid>
      <dc:creator>satoshitonoike</dc:creator>
      <dc:date>2020-09-29T12:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230157#M175893</link>
      <description>&lt;P&gt;I believe your search has errors in it.&lt;BR /&gt;&lt;BR /&gt;
The first &lt;CODE&gt;where&lt;/CODE&gt; clause is choosing events that happen on Saturday or Sunday instead of ignoring events on those days.  It should be &lt;CODE&gt;| where NOT (date_wday="saturday" OR date_wday="sunday")&lt;/CODE&gt;.&lt;BR /&gt;
The second &lt;CODE&gt;where&lt;/CODE&gt; clause does not choose events within business hours.  Try &lt;CODE&gt;|where ( (myHour &amp;gt;= 9 AND myMinute &amp;gt;= 00) AND (myHour &amp;lt;= 18 AND myMinute &amp;lt;= 00) )&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 12:16:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230157#M175893</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-01-16T12:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230158#M175894</link>
      <description>&lt;P&gt;サーチ文はとりあえずおいといて、_time（タイムスタンプ）と受付日時、対応完了日時の関係と営業時間の定義を教えてもらえますか？&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 07:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230158#M175894</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-01-17T07:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230159#M175895</link>
      <description>&lt;P&gt;Thank you for your replying to my question.&lt;BR /&gt;
I fixed my search query as you proposed however, it still counting hours that are out of business time hour.&lt;BR /&gt;
Regards. satoshi&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 09:04:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230159#M175895</guid>
      <dc:creator>satoshitonoike</dc:creator>
      <dc:date>2017-01-17T09:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230160#M175896</link>
      <description>&lt;P&gt;@HiroshiSatoh&lt;BR /&gt;
　ご質問ありがとうございます。&lt;BR /&gt;
　タイムスタンプに受付日時と対応完了日の両者を適応しております。この2項目の関係性としては、イベントの発生日時と終了日時です。&lt;BR /&gt;
　営業時間の定義としては、毎日9:00-18:00（土日を除く）を定義しています。&lt;BR /&gt;
　祝日はさすがに、入れようとすると工数がかかりすぎるため、省こうと考えています。&lt;BR /&gt;
　よろしくお願いします。&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 09:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230160#M175896</guid>
      <dc:creator>satoshitonoike</dc:creator>
      <dc:date>2017-01-17T09:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230161#M175897</link>
      <description>&lt;P&gt;On closer inspection I see a logic error:  myMinute can never be &amp;lt; 0.  Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval myTime = (myHour * 100) + myMinute
| where myTime &amp;gt;= 900 AND myTime &amp;lt;= 1800 
| ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jan 2017 12:04:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230161#M175897</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-01-17T12:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230162#M175898</link>
      <description>&lt;P&gt;Sorry for replying to you become late and, thank you for your answers.&lt;BR /&gt;
However, it cannot work proper way which I want to see.&lt;BR /&gt;
The search still collects the event where out of business hours.&lt;/P&gt;

&lt;P&gt;Regards, satoshi.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 00:32:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230162#M175898</guid>
      <dc:creator>satoshitonoike</dc:creator>
      <dc:date>2017-01-23T00:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230163#M175899</link>
      <description>&lt;P&gt;もう少し詳しく質問しますが、&lt;BR /&gt;
①_timeにはどんな日時が設定されていますか？受付日時ですか？&lt;BR /&gt;
②受付日と対応完了日で日をまたがることはありますか？&lt;BR /&gt;
③毎日9:00-18:00（土日を除く）以外の受付日時は除外で良いですか？&lt;BR /&gt;
④対応完了日時が18:00以降になった場合は18時までの時間を集計するでよいですか？&lt;/P&gt;

&lt;P&gt;③がNGの場合&lt;BR /&gt;
・9時前に受け付けて完了が9時以降のデータは対象にしますか？&lt;BR /&gt;
・9時前に受け付けたデータは9時からの時間を集計しますか？&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 05:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230163#M175899</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-01-23T05:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230164#M175900</link>
      <description>&lt;P&gt;再度ご質問、ありがとうございます。&lt;BR /&gt;
①受付日時と対応完了日の両者をタイムスタンプフィールドに設定しているので、_timeはその２つのフィールドが設定されているものと思います（不要であれば、対応完了日を外します）。&lt;BR /&gt;
②基本的に別日なので、日または月をまたぐことがあります。&lt;BR /&gt;
③はい、おっしゃる通りです。&lt;BR /&gt;
④これも、おっしゃる通りです。&lt;/P&gt;

&lt;P&gt;追随して、欲を言ってしまうと、12時から13時の間（平日）も除外したいです。&lt;BR /&gt;
ですが、これはできればという形なので、まずは上の状態で出るようにしたいです。&lt;BR /&gt;
よろしくお願いします。&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 06:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230164#M175900</guid>
      <dc:creator>satoshitonoike</dc:creator>
      <dc:date>2017-01-23T06:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230165#M175901</link>
      <description>&lt;P&gt;①ですが、Splunkの_timeは１つです。１つのログにはどちらかしか設定できません。どちらですか？または全く違う時刻が設定されていますか？ログのイメージが提示できるのならお願いします。&lt;BR /&gt;
※date_wdayは_timeの値で設定されます。&lt;/P&gt;

&lt;P&gt;②ですが、日をまたぐと計算も複雑になりますが、受付日時から完了日時までの9:00-18:00（土日を除く）間の時間を集計するでいいですか？&lt;/P&gt;

&lt;P&gt;③ですが、土日に受け付けて完了日時が平日の場合でも対象外になりますがそれでいいですか？&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:29:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230165#M175901</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-29T12:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230166#M175902</link>
      <description>&lt;P&gt;データ量にもよりますが、例えば以下のようなアプローチではどうでしょか。&lt;/P&gt;

&lt;P&gt;1.何曜日の何時台に受付したか、何曜日の何時台に完了したかを分離して別々の情報とし、&lt;BR /&gt;
2.上記の2つのデータを時間を軸に結合し、&lt;BR /&gt;
3.どの問い合わせが何曜日の何時台に対応していたかを見つけ、&lt;BR /&gt;
4.その時刻が営業時間かどうか判定して、&lt;BR /&gt;
5.その後煮るなり焼くなりする&lt;/P&gt;

&lt;P&gt;ちらっと勝手にデータ作ってやってみました。&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;業務id,受付日時,対応完了日時
id,started,completed
1,2017/1/22 18:00,2017/1/23 10:00
2,2017/1/22 15:00,2017/1/28 01:00
3,2017/1/23 09:00,2017/1/23 09:30
4,2017/1/23 15:00,2017/1/23 18:00
5,2017/1/23 15:00,2017/1/23 18:00
6,2017/1/27 15:00,2017/1/27 18:00
7,2017/1/27 17:00,2017/1/30 10:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;土日除く9am-6pmが営業だと、各id（問い合わせ）については：&lt;BR /&gt;
id1が23日の9時から10時までの1時間だけ対応&lt;BR /&gt;
id2が数日間に渡って対応はしているが、22日9時よりまえと27日の18時以降、その他の日の9時〜6時に入らない時間帯は除外&lt;BR /&gt;
id3は30分で対応終了&lt;BR /&gt;
とか、そんな感じでしょうか。（ここで理解が間違ってたら以下はおかしくなりますが参考までに書き続けます）&lt;/P&gt;

&lt;P&gt;上記のcsvをlookupsディレクトリにtest.csvとして保存し、以下を実行すると、それっぽい表がでてきます。&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup test.csv
| eval _time=strptime('started',"%Y/%m/%d %H:%M"), data="started"
| fields _time id data
| append [
| inputlookup test.csv
| eval _time=strptime('completed',"%Y/%m/%d %H:%M"), data="completed"
| fields _time id data ]
| sort  _time
| timechart span=10m list(data) by id
| filldown
| foreach * [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(match('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', "started") AND mvcount('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')=1,1,0)]
| untable _time id isWorking
| timechart span=1h max(isWorking) as isWorking by id
| eval H=strftime(_time,"%H"), W=strftime(_time,"%A")
| search NOT (W="Saturday" OR W="Sunday" OR H&amp;lt;9 OR H&amp;gt;=18)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;おそらくこの時点で、どの問い合せ(id)が何時台に対応されているかが1と0で出てくると思います。&lt;BR /&gt;
あとはidごとにsumを取れば（単純にaddtotalcolsをつけてもOK）、各問い合わせに業務時間内に何時間つかったか、がでてくるとおもいます。&lt;/P&gt;

&lt;P&gt;ヒストグラムについては上記サーチの後に以下のようにすればでてくるかとおもいます。&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| addcoltotals labelfield=H label="Total"
| where H="Total"
| fields - _time W H
| transpose 0
| rename "row 1" as H 
| bin H bins=10 
| stats count by H
| makecontinuous H
| fillnull count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2317i466472E19C32ECB7/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;ずれてるかもしれませんが、お役に立てれば幸いです。&lt;BR /&gt;
サーチが無駄にながくなってしまってすみません、、&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 10:44:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230166#M175902</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2017-01-23T10:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230167#M175903</link>
      <description>&lt;P&gt;①に関しては、受付日時のタイムスタンプになっていました。&lt;BR /&gt;
　イメージ図に関しては、申し訳ありませんが、提示しかねます。&lt;/P&gt;

&lt;P&gt;②はおっしゃる通りです。&lt;/P&gt;

&lt;P&gt;③に関しては、対象外になって大丈夫です。&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 01:14:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230167#M175903</guid>
      <dc:creator>satoshitonoike</dc:creator>
      <dc:date>2017-01-24T01:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230168#M175904</link>
      <description>&lt;P&gt;回答ありがとうございます。&lt;/P&gt;

&lt;P&gt;おっしゃっている形の表示で間違いではないのです。&lt;BR /&gt;
しかし、私のサーチの構成が下手なせいか、上手く問合せIDに紐づいて集計されないです。&lt;/P&gt;

&lt;P&gt;そこで、２点質問があり、お答え頂けるとありがたいです。&lt;/P&gt;

&lt;P&gt;【質問】&lt;BR /&gt;
・現在使用している元データ以外にlookupを作らないと仰っているような形で表示できないということでしょうか？&lt;/P&gt;

&lt;P&gt;・| foreach * [eval &amp;lt;&amp;gt;=if(match('&amp;lt;&amp;gt;', "started") AND mvcount('&amp;lt;&amp;gt;')=1,1,0)]&lt;BR /&gt;
  | untable _time id isWorking&lt;BR /&gt;
　上記検索文の使い方と、isWorkingとはどこから来たのか、もしくはどのようなフィールドを指定するといった意味合いで書かれたのでしょうか？&lt;/P&gt;

&lt;P&gt;よろしくお願いします。&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 01:50:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230168#M175904</guid>
      <dc:creator>satoshitonoike</dc:creator>
      <dc:date>2017-01-24T01:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230169#M175905</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;・現在使用している元データ以外にlookupを作らないと仰っているような形で表示できないということでしょうか？
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;元データだけでできるとおもいますよ。&lt;BR /&gt;
私のテストデータでは、データをインデックスするのが手間だったので、&lt;BR /&gt;
元データとしてcsvをつかっただけです。&lt;BR /&gt;
ですので、| inputlookup test.csv あたりを index=問合せ対応_index として読み替えていただければと思います。&lt;BR /&gt;
また、_timeでjoinをしている箇所がありますが、この部分でのポイントは、_timeをjoinの前の部分ではstartedの日時、joinの後の部分ではcompletedの日時にしている点です。&lt;/P&gt;

&lt;P&gt;このjoinでおこなっているのは、以下の一つのイベントを：&lt;BR /&gt;
受付ID=1, 受付時刻=2017/01/23 9:00, 完了時刻=2017/01/23 10:00&lt;/P&gt;

&lt;P&gt;以下のような2つの情報に変換しています。&lt;/P&gt;

&lt;P&gt;_time=2017/01/23 9:00, 受付ID=1, data=受付&lt;BR /&gt;
_time=2017/01/23 10:00, 受付ID=1, data=完了&lt;/P&gt;

&lt;P&gt;上記のようなデータに変換してから各種集計を行っています。&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;・| foreach * [eval &amp;lt;&amp;gt;=if(match('&amp;lt;&amp;gt;', "started") AND mvcount('&amp;lt;&amp;gt;')=1,1,0)]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;各フィールドに対して処理や判断を書ける場合にforeachをつかいます。&lt;BR /&gt;
今回は、各フィールドとなっている部分がtimechart の結果として出てきた各idで、&lt;BR /&gt;
何時台に処理が開始したのか終了したのかを判定して、1か0に置き換えています。&lt;BR /&gt;
具体的には、各idのデータを参照して、startedという文字列のみであれば1,&lt;BR /&gt;
それ以外(データ無しもしくはcompletedもしくはstarted,completedの2つが入っている時間帯)は0とする、&lt;BR /&gt;
としてます。&lt;BR /&gt;
&amp;lt;&amp;gt;には、実際には各フィールド名がはいってきますので、今回の場合は、&lt;BR /&gt;
1,2,3,4,5,6,7といったように順番にidごとに判定代入処理をおこなっていくことになります。&lt;/P&gt;

&lt;P&gt;詳細はドキュメントのforeachコマンドの概要よんでいただいて、上記のサンプルデータとサンプルサーチを動かして見ていただければと思います。&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;・| untable _time id isWorking　isWorkingとはどこから来たのか
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;table形式になっているものを、分解する際にuntableというコマンドが使えます。&lt;BR /&gt;
前段で各idがどの時間帯に対応されているかが1か0で表示されているところまででてきているかとおもいます。&lt;/P&gt;

&lt;P&gt;_time   1   2   3   4&lt;BR /&gt;
9:00    0   0   0   0&lt;BR /&gt;
10:00   1   0   1   0&lt;BR /&gt;
11:00   1   0   0   0&lt;BR /&gt;
12:00   1   0   0   1&lt;/P&gt;

&lt;P&gt;これを以下のように変換するのにuntableをつかってます。&lt;BR /&gt;
isWorkingは上のテーブルのcellに当たる部分に名前をつけているイメージです。&lt;/P&gt;

&lt;P&gt;_time,id,isWorking&lt;BR /&gt;
9:00,1,0&lt;BR /&gt;
9:00,2,0&lt;BR /&gt;
9:00,3,0&lt;BR /&gt;
9:00,4,0&lt;BR /&gt;
10:00,1,1&lt;BR /&gt;
10:00,2,0&lt;BR /&gt;
10:00,3,1&lt;BR /&gt;
10:00,4,0&lt;BR /&gt;
11:00,1,1&lt;BR /&gt;
11:00,2,0&lt;BR /&gt;
11:00,3,0&lt;BR /&gt;
11:00,4,0&lt;BR /&gt;
12:00,1,1&lt;BR /&gt;
12:00,2,0&lt;BR /&gt;
12:00,3,0&lt;BR /&gt;
12:00,4,1&lt;/P&gt;

&lt;P&gt;test.csvを使ったサンプルでは、一旦10分毎に各idが対応されているかを判定してますが、&lt;BR /&gt;
これを更に1時間集計（何時台）に再集計し直すさいにuntableを事前にやることでtimechart ... by id とできるようにしています。&lt;BR /&gt;
もっと短くかけるとはおもいますが…(汗&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:35:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230169#M175905</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2020-09-29T12:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230170#M175906</link>
      <description>&lt;P&gt;お早い返答ありがとうございます。&lt;/P&gt;

&lt;P&gt;先程、いろいろな形で確かめてみましたが、データ量が多いせいなのか、私の認識が薄いせいかはわかりませんが、Hの数が1000-2000(H)と2000-3000(H)の集計になってしまうなど、きれいにヒストグラムになりません。&lt;/P&gt;

&lt;P&gt;詳しくご回答くださったのに、使いこなせなくて申し訳ありません。。&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 05:17:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230170#M175906</guid>
      <dc:creator>satoshitonoike</dc:creator>
      <dc:date>2017-01-24T05:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: 営業日・時間内のイベントのみカウント</title>
      <link>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230171#M175907</link>
      <description>&lt;P&gt;※melonmanさんのフィールド名を使わせて頂きました。&lt;/P&gt;

&lt;P&gt;idの件数が多いとパフォーマンスの問題がでると思いますが、とりあえず計算するみたいです。結果はid毎の稼働時間の集計です。&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;･･･ date_wday!="saturday" AND date_wday!="sunday" AND date_hour&amp;gt;8 AND date_hour&amp;lt;18
|eval wk_started=strftime(strptime(started,"%Y/%m/%d%H:%M"),"%m/%d/%y:%H:%M:%S")
|eval wk_completed=strftime(strptime(completed,"%Y/%m/%d %H:%M"),"%m/%d/%y:%H:%M:%S")
|map search="|gentimes start=$wk_started$ end=$wk_completed$ increment=1h
|eval _time=starttime,id=$id$"
|eval wk_wday=strftime(_time,"%w"),wk_hour=strftime(_time,"%H")
|table id,_time,wk_wday,wk_hour
|where (wk_wday!=0 AND wk_wday!=6) AND (wk_hour&amp;gt;"08" AND wk_hour&amp;lt;"18" AND wk_hour!="12")
|stats count by id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jan 2017 10:56:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/%E5%96%B6%E6%A5%AD%E6%97%A5-%E6%99%82%E9%96%93%E5%86%85%E3%81%AE%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%81%AE%E3%81%BF%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88/m-p/230171#M175907</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-01-24T10:56:16Z</dc:date>
    </item>
  </channel>
</rss>

