<?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: How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475148#M133563</link>
    <description>&lt;P&gt;ahh, it works and it looks so simple.  I guess i was making it harder than it needed to be with trying to use transaction etc.  thank you! &lt;/P&gt;</description>
    <pubDate>Tue, 05 Nov 2019 21:54:52 GMT</pubDate>
    <dc:creator>justinsplunk_12</dc:creator>
    <dc:date>2019-11-05T21:54:52Z</dc:date>
    <item>
      <title>How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475141#M133556</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I'm working with a sample log snippet below.&lt;BR /&gt;&lt;BR /&gt;
The overall goal is to get stats about long-running operations.  I am trying to display the etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds (etime&amp;gt;20).&lt;BR /&gt;&lt;BR /&gt;
I've tried using "transaction" with conn but I do not know how to manipulate the data afterwards.&lt;BR /&gt;&lt;BR /&gt;
I am trying to get an output that looks similar to,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;conn         bind_id               search_filter    etime
65110583     "uid=hello,o=test"    "(uid=abc*)"     165
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;::Log snippet::&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-10-15T08:20:06+00:00 serverABC ACCESSLOG[15/Oct/2019]: 04:20:05 -0400] conn=65110583 op=-1 msgId=-1 -  connection from 10.10.10.10:1234 to 10.10.10.15
2019-10-15T08:20:06+00:00 serverABC ACCESSLOG[15/Oct/2019]: 04:20:05 -0400] conn=65110583 op=0 msgId=1 - BIND dn="uid=hello,o=test"
2019-10-15T08:20:06+00:00 serverABC ACCESSLOG[15/Oct/2019]: 04:20:05 -0400] conn=65110583 op=0 msgId=1 - RESULT err=0 tag=97 nentries=0 etime=0 dn="uid=hello,o=test"
2019-10-15T08:20:06+00:00 serverABC ACCESSLOG[15/Oct/2019]: 04:20:06 -0400] conn=65110583 op=1 msgId=2 - SRCH base="ou=everyone,o=test" scope=2 filter="(uid=abc*)" attrs="cn"
2019-10-15T08:20:10+00:00 serverABC ACCESSLOG[15/Oct/2019]: 04:20:08 -0400] conn=65110583 op=1 msgId=2 -  SORT uid (269746)
2019-10-15T08:23:01+00:00 serverABC ACCESSLOG[15/Oct/2019]: 04:22:51 -0400] conn=65110583 op=1 msgId=2 - RESULT err=0 tag=101 nentries=269746 etime=165 notes=U
2019-10-15T08:28:42+00:00 serverABC ACCESSLOG[15/Oct/2019]: 04:28:34 -0400] conn=65110583 op=2 msgId=3 - UNBIND
2019-10-15T08:28:42+00:00 serverABC ACCESSLOG[15/Oct/2019]: 04:28:34 -0400] conn=65110583 op=2 msgId=-1 - closing from 10.10.10.10:1234 - U1 - Connection closed by unbind client -
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:49:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475141#M133556</guid>
      <dc:creator>justinsplunk_12</dc:creator>
      <dc:date>2020-09-30T02:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475142#M133557</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="YouShouldAlwaysSpecifyAnIndex" AND sourcetype="AndSourcetypeToo"
| stats range(_time) AS duration max(etime) AS etime_max sum(etime) AS etime_total BY conn bind_id search_filter
| fieldformat duration=tostring(duration, "duration")
| fieldformat etime_max=tostring(etime_max, "duration")
| fieldformat etime_total=tostring(etime_total, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Nov 2019 16:45:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475142#M133557</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-04T16:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475143#M133558</link>
      <description>&lt;P&gt;try this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;your_index&amp;gt; 
| rex "dn=\"(?&amp;lt;bind_id&amp;gt;[^\"]+)" 
| rex "conn=(?&amp;lt;conn&amp;gt;\d+)" 
| rex "filter=\"\((?&amp;lt;search_filter&amp;gt;[^\)]+)" 
| rex "etime=(?&amp;lt;etime&amp;gt;\d+)" 
| stats values(bind_id) as bind_id max(etime) as etime_max values(search_filter) as search_filter by conn 
|  where etime_max &amp;gt; 20
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If all the required fields are already extracted then don't use the rex expressions.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 17:05:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475143#M133558</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-04T17:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475144#M133559</link>
      <description>&lt;P&gt;thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/172209"&gt;@mayurr98&lt;/a&gt;. this worked for most of the connections.  Others have multiple searches in one connection start to end and so I find i need to group by conn and msgId.  Im just trying to figure out how to now associate bind_id with the conn.  I was thinking maybe some sort of subsearch, appendcols, or join ?  Not sure.&lt;BR /&gt;
For example:&lt;/P&gt;

&lt;P&gt;index=xyz host=serverABC &lt;BR /&gt;
 | rex "BIND dn=(?.&lt;EM&gt;)\smethod" &lt;BR /&gt;
 | rex "filter=(?.&lt;/EM&gt;)\sattrs"&lt;BR /&gt;
 | stats values(bind_id) as bind_id max(etime) as etime_max values(search_filter) as search_filter by conn msgId&lt;BR /&gt;
 |  where etime_max &amp;gt; 20&lt;/P&gt;

&lt;P&gt;output:&lt;BR /&gt;
conn        msgId   bind_id     etime_max   search_filter&lt;BR /&gt;
11001119    3                   22          "(uid=abc*)"&lt;BR /&gt;
11001119    2                   25          "(uid=123*)"&lt;/P&gt;

&lt;P&gt;2019-11-05T07:24:27+00:00 serverABC ACCESSLOG[05/Nov/2019]: 02:24:24 -0500] conn=11001119 op=0 msgId=1 - BIND dn="uid=hello,o=test"&lt;BR /&gt;
2019-11-05T07:24:27+00:00 serverABC ACCESSLOG[05/Nov/2019]: 02:24:24 -0500] conn=11001119 op=0 msgId=1 - RESULT err=0 tag=97 nentries=0 etime=0 "uid=hello,o=test"&lt;BR /&gt;
2019-11-05T07:24:27+00:00 serverABC ACCESSLOG[05/Nov/2019]: 02:24:24 -0500] conn=11001119 op=1 msgId=2 - SRCH base="ou=none,o=test" scope=2 filter="(uid=xyz*)" attrs="cn"&lt;BR /&gt;
2019-11-05T07:24:27+00:00 serverABC ACCESSLOG[05/Nov/2019]: 02:24:24 -0500] conn=11001119 op=1 msgId=2 - RESULT err=0 tag=101 nentries=1 etime=25&lt;BR /&gt;
2019-11-05T07:24:27+00:00 serverABC ACCESSLOG[05/Nov/2019]: 02:24:24 -0500] conn=11001119 op=2 msgId=3 - SRCH base="ou=everyone,o=test" scope=2 filter="(uid=abc*)" attrs="cn"&lt;BR /&gt;
2019-11-05T07:24:38+00:00 serverABC ACCESSLOG[05/Nov/2019]: 02:24:28 -0500] conn=11001119 op=2 msgId=3 - RESULT err=0 tag=101 nentries=7187 etime=22&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:52:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475144#M133559</guid>
      <dc:creator>justinsplunk_12</dc:creator>
      <dc:date>2020-09-30T02:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475145#M133560</link>
      <description>&lt;P&gt;how does your output look like in this case?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 19:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475145#M133560</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-05T19:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475146#M133561</link>
      <description>&lt;P&gt;Sorry theres some weird formatting for the splunk search i replied with.  The bind_id is blank but everything else is correct. &lt;/P&gt;

&lt;P&gt;The output is like this:&lt;BR /&gt;
conn               msgId     bind_id    etime_max     search_filter&lt;BR /&gt;
11001119       3                               22                   "(uid=abc*)"&lt;BR /&gt;
11001119       2                               25                   "(uid=123*)"&lt;/P&gt;

&lt;P&gt;Desired output:&lt;BR /&gt;
conn               msgId     bind_id                              etime_max     search_filter&lt;BR /&gt;
11001119       3             "uid=hello,o=test"            22                   "(uid=abc*)"&lt;BR /&gt;
11001119       2             "uid=hello,o=test"            25                   "(uid=123*)"&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:52:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475146#M133561</guid>
      <dc:creator>justinsplunk_12</dc:creator>
      <dc:date>2020-09-30T02:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475147#M133562</link>
      <description>&lt;P&gt;add this after stats command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats values(bind_id) as bind_id by conn  
|  where etime_max &amp;gt; 20
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Nov 2019 21:38:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475147#M133562</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-05T21:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull stats to display etime, bind_id, conn, and the search_filter for any operation that takes longer than 20 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475148#M133563</link>
      <description>&lt;P&gt;ahh, it works and it looks so simple.  I guess i was making it harder than it needed to be with trying to use transaction etc.  thank you! &lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 21:54:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pull-stats-to-display-etime-bind-id-conn-and-the-search/m-p/475148#M133563</guid>
      <dc:creator>justinsplunk_12</dc:creator>
      <dc:date>2019-11-05T21:54:52Z</dc:date>
    </item>
  </channel>
</rss>

