svcs' new -L option

In Solaris 11.2, svcs gained a new option, ā€œ-Lā€.  The -L option allows a user to easily look at the most recent log events for a service.

The addition of the -x option (e.g svcs -xL mysvc:default) will print the normal -x output for the service:instance given, but will additionally print one of the following subsets of log file content :

1. Start at the last occurrence of the log message for a method exit without errors.
2. The last 10 lines of the log file if smaller than (1)
3. If the last line is the successful exit then print the last 5 lines of the log file
4. If the last method exit has errors, the last ten lines of the log file is presented.

In the following example, the start method exited with an error, and the last ten lines
of the log file are shown.

# svcs -xL svc:/mysvc:myinst
 State: maintenance since Mon Aug 04 15:17:51 2014
Reason: Start method failed repeatedly, last exited with status 1.
   See: http://support.oracle.com/msg/SMF-8000-KS
   See: /var/svc/log/mysvc:myinst.log
Impact: This service is not running.
   Log:
[ 2014 Aug  4 15:17:51 Leaving maintenance because clear requested. ]
[ 2014 Aug  4 15:17:51 Enabled. ]
[ 2014 Aug  4 15:17:51 Executing start method ("/root/blah.ksh start"). ]
Hello... starting 1
Hello... starting 2
Hello... starting 3
Hello... starting 4
Hello... starting 5
[ 2014 Aug  4 15:17:51 Method "start" exited with status 1. ]
[ 2014 Aug  4 15:18:09 Rereading configuration. ]

Making this the default output of svcs -x is under consideration for a future release of Solaris.

Simply using -L by itself, the name of the log file is given and you could do the following to print the contents of the log file :

# less `svcs -L mysvc:default` 

Or add the -v option (svcs -vL mysvc:default) to display the full content of the log file.

# svcs -vL mysvc:myinst | less
svc:/mysvc:myinst
[ 2014 Jul 25 10:10:08 Enabled. ]
[ 2014 Jul 25 10:10:08 Rereading configuration. ]
[ 2014 Jul 25 10:10:08 Executing start method (:true). ]
[ 2014 Jul 25 11:06:11 Enabled. ]
[ 2014 Jul 25 11:06:11 Rereading configuration. ]
[ 2014 Jul 25 11:06:11 Executing start method (:true). ]
ā€¦
[ 2014 Jul 30 12:52:04 Executing stop method ("/root/blah.ksh stop"). ]
Hello... stopping
[ 2014 Jul 30 12:52:04 Method "stop" exited with status 0. ]
[ 2014 Aug  4 15:14:09 Disabled. ]
[ 2014 Aug  4 15:14:59 Enabled. ]

If multiple instances are provided with the -vL option then only the last 10 lines
of the log files are presented.  For example :

svcs -Lv svc:/system/name-service/cache:default svc:/system/fm/smtp-notify:default

svc:/system/name-service/cache:default (name service cache)
[ 2014 Jun 20 09:10:32 Executing start method ("/lib/svc/method/svc-nscd start"). ]
[ 2014 Jun 20 09:10:33 Method "start" exited with status 0. ]
[ 2014 Jul 17 08:34:25 Disabled. ]
[ 2014 Jul 17 08:34:26 Enabled. ]
[ 2014 Jul 17 08:35:07 Executing start method ("/lib/svc/method/svc-nscd start"). ]
[ 2014 Jul 17 08:35:08 Method "start" exited with status 0. ]
[ 2014 Jul 28 05:31:51 Stopping because service restarting. ]
[ 2014 Jul 28 05:31:52 Executing stop method (:kill). ]
[ 2014 Jul 28 05:31:52 Executing start method ("/lib/svc/method/svc-nscd start"). ]
[ 2014 Jul 28 05:31:52 Method "start" exited with status 0. ]

svc:/system/fm/smtp-notify:default (Solaris Email Event Notification Agent)
[ 2014 Apr 30 08:47:06 Method "start" exited with status 0. ]
[ 2014 May 24 13:12:14 Enabled. ]
[ 2014 May 24 13:22:49 Executing start method ("/usr/lib/fm/notify/smtp-notify"). ]
[ 2014 May 24 13:22:49 Method "start" exited with status 0. ]
[ 2014 Jun 20 09:09:43 Enabled. ]
[ 2014 Jun 20 09:21:58 Executing start method ("/usr/lib/fm/notify/smtp-notify"). ]
[ 2014 Jun 20 09:21:58 Method "start" exited with status 0. ]
[ 2014 Jul 17 08:34:30 Enabled. ]
[ 2014 Jul 17 08:45:47 Executing start method ("/usr/lib/fm/notify/smtp-notify"). ]
[ 2014 Jul 17 08:45:47 Method "start" exited with status 0. ]

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Solaris Service Management Facility information, tips and tricks.

Search

Categories
Archives
« September 2015
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today