{"id":400,"date":"2011-01-28T00:30:38","date_gmt":"2011-11-02T05:51:50","guid":{"rendered":"http:\/\/kraftek.com\/blog\/last-failedsuccessful-sulog-entries-for-n-days-ago\/"},"modified":"2011-01-28T00:30:38","modified_gmt":"2011-11-02T05:51:50","slug":"last-failedsuccessful-sulog-entries-for-n-days-ago","status":"publish","type":"post","link":"\/blog\/index.php\/last-failedsuccessful-sulog-entries-for-n-days-ago\/","title":{"rendered":"last failed\/successful &#8220;sulog&#8221; entries for N days ago"},"content":{"rendered":"<p>You want to know for the latest N days who was able\/unable to su, in solaris. Sulog is in \/var\/adm\/sulog, and we don&#8217;t<br \/>\nhave the niceties of GNU date, so we use perl inside a shell&#8230; &#8220;suentries.ksh&#8221;<br \/>\n<em>#!\/bin\/ksh<\/em><br \/>\n<em> #&#8212; n has how many days ago we want<\/em><br \/>\n<em> n=$1<\/em><br \/>\n<em> today=`\/usr\/bin\/perl -e &#8216;printf &#8220;%dn&#8221;, time;&#8217;`<\/em><br \/>\n<em> x=$n<\/em><br \/>\n<em> while [ $x -gt -1 ];do<\/em><br \/>\n<em> ago=$(($today-86400*${x}))<\/em><br \/>\n<em> export ago<\/em><br \/>\n<em> DAY=`perl -e &#8216;($a,$b,$c,$d,$e,$f,$g,$h,$i) =localtime($ENV{&#8216;ago&#8217;});printf&#8221;%02d\/%02dn&#8221;,$e+1,$d&#8217;`<\/em><br \/>\n<em> echo &#8220;&#8212;- $DAY&#8221;<\/em><br \/>\n<em> cat \/var\/adm\/sulog | grep $DAY<\/em><br \/>\n<em> x=$(($x-1))<\/em><br \/>\n<em> done<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You want to know for the latest N days who was able\/unable to su, in solaris. Sulog is in \/var\/adm\/sulog, and we don&#8217;t have the niceties of GNU date, so we use perl inside a shell&#8230; &#8220;suentries.ksh&#8221; #!\/bin\/ksh #&#8212; n has how many days ago we want n=$1 today=`\/usr\/bin\/perl -e &#8216;printf &#8220;%dn&#8221;, time;&#8217;` x=$n while [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-400","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=400"}],"version-history":[{"count":0,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/400\/revisions"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=400"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}