<?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: Help with alert set up in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/599016#M13876</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120532"&gt;@vrmandadi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;debug your search starting from the end deleting one row at a time,&lt;/P&gt;&lt;P&gt;in other words: if you run&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc  session_points="session opened" OR session_points="session closed" session_user!=root earliest=-8h@h latest=@h
| eval type=if(searchmatch("session opened for user"),"open","close")&lt;/LI-CODE&gt;&lt;P&gt;have you both values for type?&lt;/P&gt;&lt;P&gt;what does it happen if you run&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc  session_points="session opened" OR session_points="session closed" session_user!=root earliest=-8h@h latest=@h
| eval type=if(searchmatch("session opened for user"),"open","close")
| stats
first(if(eval(type="open"),_time,"")) AS earliest
latest(if(eval(type="close"),_time,"")) AS latest
dc(type) AS dc_type
values(type) AS type
BY session_user&lt;/LI-CODE&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 May 2022 06:39:09 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-05-24T06:39:09Z</dc:date>
    <item>
      <title>How to create an alert based on syslog login and logout data?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598777#M13867</link>
      <description>&lt;P&gt;I want to create an alert based on syslog login and logout data.I want the alert to be triggered when a session is opened for but doesnt have a session closed for&amp;nbsp; a particular session id and if that session is opened for more than 8 hours compared to the time the splunk alert is scheduled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example if a session is opened by a user at 8AM and if he doesnt log off by 4PM which is more than 8 hrs than it needs to be alerted by giving the user session id&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Following are the sample data for&amp;nbsp; login and logoff sessions&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;2022-05-21T20:00:02.048677-07:00&lt;/SPAN&gt; &lt;SPAN class=""&gt;login-se01&lt;/SPAN&gt; &lt;SPAN class=""&gt;CRON&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;4031976&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;pam_unix&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;cron:session&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;session&lt;/SPAN&gt; &lt;SPAN class=""&gt;closed&lt;/SPAN&gt; &lt;SPAN class=""&gt;for&lt;/SPAN&gt; &lt;SPAN class=""&gt;user&lt;/SPAN&gt; &lt;SPAN class=""&gt;abc&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;2022&lt;/SPAN&gt;-05-21T20:00:02.041845-07:00 login-se01 CRON&lt;SPAN&gt;[&lt;/SPAN&gt;4031976&lt;SPAN&gt;]&lt;/SPAN&gt;: pam_unix&lt;SPAN&gt;(&lt;/SPAN&gt;cron:session&lt;SPAN&gt;)&lt;/SPAN&gt;: session opened for user abc by&lt;SPAN&gt; (&lt;/SPAN&gt;uid=0)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 19:47:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598777#M13867</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2022-05-22T19:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with alert set up</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598783#M13870</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120532"&gt;@vrmandadi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=os ("session closed for user" OR "session opened for user") earliest=-8h@h latest=@h
| eval type=if(searchmatch("session opened for user"),"open","close")
| stats 
     first(if(eval(type="open"),_time,"") AS earliest 
     latest(if(eval(type="close"),_time,"") AS latest
     dc(type) AS dc_type 
     values(type) AS type 
     BY user
| where dc_type=1 AND type="open"
| eval 
     earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S), 
     latest=strftime(latest,"%Y-%m-%d %H:%M:%S)
table user earliest latest&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 08:20:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598783#M13870</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-22T08:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with alert set up</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598788#M13871</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the following error "&lt;SPAN&gt;Error in 'eval' command: The expression is malformed. An unexpected character is reached at '%m-%d %H:%M:%S)'."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think there is an issue&amp;nbsp; starting from&amp;nbsp;&lt;BR /&gt;| where dc_type=1 AND type="open"&lt;BR /&gt;| eval&lt;BR /&gt;earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S),&lt;BR /&gt;latest=strftime(latest,"%Y-%m-%d %H:%M:%S)&lt;BR /&gt;| table session_user earliest latest&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also running the search without the where clause doesnt show any value for earliest and latest time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;session_user earliest latest dc_type type&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;abc&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;close&lt;/DIV&gt;&lt;DIV class=""&gt;open&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 22 May 2022 14:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598788#M13871</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2022-05-22T14:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with alert set up</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598831#M13872</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120532"&gt;@vrmandadi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;sorry! the quotes in the evals and the pipe before table:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=os ("session closed for user" OR "session opened for user") earliest=-8h@h latest=@h
| eval type=if(searchmatch("session opened for user"),"open","close")
| stats 
     first(if(eval(type="open"),_time,"") AS earliest 
     latest(if(eval(type="close"),_time,"") AS latest
     dc(type) AS dc_type 
     values(type) AS type 
     BY user
| where dc_type=1 AND type="open"
| eval 
     earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S"), 
     latest=strftime(latest,"%Y-%m-%d %H:%M:%S")
| table user earliest latest&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 06:24:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598831#M13872</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-23T06:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with alert set up</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598916#M13873</link>
      <description>&lt;P&gt;I still dont see the earliest and latest time...may be the strptime format needs to be changed..Below is the sample event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;2022-05-23T06:00:01.676861-07:00&lt;/SPAN&gt; &lt;SPAN class=""&gt;login-1&lt;/SPAN&gt; &lt;SPAN class=""&gt;CRON&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;114336&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;pam_unix&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;cron:session&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;session&lt;/SPAN&gt; &lt;SPAN class=""&gt;closed&lt;/SPAN&gt; &lt;SPAN class=""&gt;for&lt;/SPAN&gt; &lt;SPAN class=""&gt;user&lt;/SPAN&gt;&amp;nbsp;abc&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;2022-05-23T06:00:01.670790-07:00&lt;/SPAN&gt; &lt;SPAN class=""&gt;login-1&lt;/SPAN&gt; &lt;SPAN class=""&gt;CRON&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;114336&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;pam_unix&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;cron:session&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;session&lt;/SPAN&gt; &lt;SPAN class=""&gt;opened&lt;/SPAN&gt; &lt;SPAN class=""&gt;for&lt;/SPAN&gt; &lt;SPAN class=""&gt;user&lt;/SPAN&gt;&amp;nbsp;abc&amp;nbsp;&lt;SPAN class=""&gt;by&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN class=""&gt;uid=0)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 14:01:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598916#M13873</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2022-05-23T14:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with alert set up</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598921#M13874</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120532"&gt;@vrmandadi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;no the strftime is only to format the output not to read because _time is in epochtime.&lt;/P&gt;&lt;P&gt;Could you share the search you're using?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 15:20:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598921#M13874</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-23T15:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help with alert set up</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598924#M13875</link>
      <description>&lt;P&gt;index=abc&amp;nbsp; session_points="session opened" OR session_points="session closed" session_user!=root earliest=-8h@h latest=@h&lt;BR /&gt;| eval type=if(searchmatch("session opened for user"),"open","close")&lt;BR /&gt;| stats&lt;BR /&gt;first(if(eval(type="open"),_time,"")) AS earliest&lt;BR /&gt;latest(if(eval(type="close"),_time,"")) AS latest&lt;BR /&gt;dc(type) AS dc_type&lt;BR /&gt;values(type) AS type&lt;BR /&gt;BY session_user&lt;BR /&gt;| where dc_type=2 AND type="close"&lt;BR /&gt;| eval&lt;BR /&gt;earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S"),&lt;BR /&gt;latest=strftime(latest,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;| table session_user earliest latest&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 15:37:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/598924#M13875</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2022-05-23T15:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help with alert set up</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/599016#M13876</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120532"&gt;@vrmandadi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;debug your search starting from the end deleting one row at a time,&lt;/P&gt;&lt;P&gt;in other words: if you run&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc  session_points="session opened" OR session_points="session closed" session_user!=root earliest=-8h@h latest=@h
| eval type=if(searchmatch("session opened for user"),"open","close")&lt;/LI-CODE&gt;&lt;P&gt;have you both values for type?&lt;/P&gt;&lt;P&gt;what does it happen if you run&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc  session_points="session opened" OR session_points="session closed" session_user!=root earliest=-8h@h latest=@h
| eval type=if(searchmatch("session opened for user"),"open","close")
| stats
first(if(eval(type="open"),_time,"")) AS earliest
latest(if(eval(type="close"),_time,"")) AS latest
dc(type) AS dc_type
values(type) AS type
BY session_user&lt;/LI-CODE&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 06:39:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/599016#M13876</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-24T06:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with alert set up</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/599083#M13877</link>
      <description>&lt;P&gt;Yes I did the line to line search and I see that when it comes to below..it doesnt show earliest and latest...it shows blank&lt;/P&gt;&lt;P&gt;| stats&lt;BR /&gt;first(if(eval(type="open"),_time,"")) AS earliest&lt;BR /&gt;latest(if(eval(type="close"),_time,"")) AS latest&lt;BR /&gt;dc(type) AS dc_type&lt;BR /&gt;values(type) AS type&lt;BR /&gt;BY session_user&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 14:09:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-based-on-syslog-login-and-logout-data/m-p/599083#M13877</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2022-05-24T14:09:57Z</dc:date>
    </item>
  </channel>
</rss>

