<?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 How to use timechart command for the below query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434528#M124001</link>
    <description>&lt;P&gt;This is the query i m using:&lt;BR /&gt;
&lt;STRONG&gt;query1:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tanium earliest=-24h query="User-Sessions-and-Boot-Time-Details-from-Windows" OR query="User-current-session-details-&amp;amp;-Last-Boot-Time---Mac-OSX-to-Splunk" Uptime="1 days" OR Uptime="Less than 1 day" NOT Last_Logged_In_User="*adm"| table Computer_Name Last_Logged_In_User OS_Boot_Time Last_Reboot| eval LastReboot = coalesce(OS_Boot_Time, Last_Reboot)| dedup LastReboot,Last_Logged_In_User| stats count by Computer_Name,Last_Logged_In_User | where count&amp;gt;2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i need a trend analysis for this query for last 30 days.&lt;/P&gt;

&lt;P&gt;I also did this:&lt;BR /&gt;
&lt;STRONG&gt;query2:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tanium query="User-Sessions-and-Boot-Time-Details-from-Windows" OR query="User-current-session-details-&amp;amp;-Last-Boot-Time---Mac-OSX-to-Splunk" NOT Last_Logged_In_User="*adm" | eval LastReboot = coalesce(OS_Boot_Time, Last_Reboot)| dedup LastReboot,Last_Logged_In_User| timechart span=1d count |eval day = strftime(_time,"%d %b %y , %a") |chart sum(count) by day
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, this gives me the entire number of events.&lt;BR /&gt;
Can anyone help me how to add required condition from query1 to query2&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2019 05:49:03 GMT</pubDate>
    <dc:creator>divyathota</dc:creator>
    <dc:date>2019-03-08T05:49:03Z</dc:date>
    <item>
      <title>How to use timechart command for the below query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434528#M124001</link>
      <description>&lt;P&gt;This is the query i m using:&lt;BR /&gt;
&lt;STRONG&gt;query1:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tanium earliest=-24h query="User-Sessions-and-Boot-Time-Details-from-Windows" OR query="User-current-session-details-&amp;amp;-Last-Boot-Time---Mac-OSX-to-Splunk" Uptime="1 days" OR Uptime="Less than 1 day" NOT Last_Logged_In_User="*adm"| table Computer_Name Last_Logged_In_User OS_Boot_Time Last_Reboot| eval LastReboot = coalesce(OS_Boot_Time, Last_Reboot)| dedup LastReboot,Last_Logged_In_User| stats count by Computer_Name,Last_Logged_In_User | where count&amp;gt;2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i need a trend analysis for this query for last 30 days.&lt;/P&gt;

&lt;P&gt;I also did this:&lt;BR /&gt;
&lt;STRONG&gt;query2:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tanium query="User-Sessions-and-Boot-Time-Details-from-Windows" OR query="User-current-session-details-&amp;amp;-Last-Boot-Time---Mac-OSX-to-Splunk" NOT Last_Logged_In_User="*adm" | eval LastReboot = coalesce(OS_Boot_Time, Last_Reboot)| dedup LastReboot,Last_Logged_In_User| timechart span=1d count |eval day = strftime(_time,"%d %b %y , %a") |chart sum(count) by day
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, this gives me the entire number of events.&lt;BR /&gt;
Can anyone help me how to add required condition from query1 to query2&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 05:49:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434528#M124001</guid>
      <dc:creator>divyathota</dc:creator>
      <dc:date>2019-03-08T05:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use timechart command for the below query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434529#M124002</link>
      <description>&lt;P&gt;If you want a trendline, you might want to use &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/trendline"&gt;trendline&lt;/A&gt; instead of chart. This one does what you want. Look at the examples in the docs.&lt;BR /&gt;
Also, you might want to use &lt;CODE&gt;Last_Logged_In_User!="*adm"&lt;/CODE&gt; instead of &lt;CODE&gt;NOT Last_Logged_In_User="*adm"&lt;/CODE&gt; if you're always expecting a user in your events.&lt;/P&gt;

&lt;P&gt;Edit: In your first query, that &lt;CODE&gt;table&lt;/CODE&gt; command is kind of useless. You can remove it If you're after speeding up the query, replace it with &lt;CODE&gt;fields&lt;/CODE&gt; and put only the needed events in.&lt;/P&gt;

&lt;P&gt;Skalli&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2019 16:27:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434529#M124002</guid>
      <dc:creator>skalliger</dc:creator>
      <dc:date>2019-03-10T16:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use timechart command for the below query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434530#M124003</link>
      <description>&lt;P&gt;@divyathota, is the following what you are looking for?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tanium earliest=-24h query="User-Sessions-and-Boot-Time-Details-from-Windows" OR query="User-current-session-details-&amp;amp;-Last-Boot-Time---Mac-OSX-to-Splunk" Uptime="1 days" OR Uptime="Less than 1 day" Last_Logged_In_User!="*adm"
| eval LastReboot = coalesce(OS_Boot_Time, Last_Reboot) 
| dedup LastReboot,Last_Logged_In_User
| bin _time span=1d
| stats count by _time, Last_Logged_In_User, Computer_Name
| search count&amp;gt;2
| timechart sum(count) as Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Mar 2019 17:31:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434530#M124003</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-03-10T17:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use timechart command for the below query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434531#M124004</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YouShouldAlwaysSpecifyIndexValues AND ((sourcetype=tanium AND query="User-Sessions-and-Boot-Time-Details-from-Windows") OR (query="User-current-session-details-&amp;amp;-Last-Boot-Time---Mac-OSX-to-Splunk" AND NOT Last_Logged_In_User="*adm"))
| eval LastReboot = coalesce(OS_Boot_Time, Last_Reboot) 
| dedup LastReboot,Last_Logged_In_User 
| bin _time span=1d 
| eventstats count BY Computer_Name,Last_Logged_In_User _time 
| where count&amp;gt;2 
| timechart span=1d count 
| eval day = strftime(_time,"%d %b %y , %a") 
| chart sum(count) by day
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;NOTE: I may not have done the parentheses correctly but you should NEVER EVER mix &lt;CODE&gt;AND&lt;/CODE&gt; and &lt;CODE&gt;OR&lt;/CODE&gt; without parentheses!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 03:20:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-timechart-command-for-the-below-query/m-p/434531#M124004</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-03-11T03:20:06Z</dc:date>
    </item>
  </channel>
</rss>

