supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* runit logging questions
@ 2013-04-30 19:43 Raymond Barlow
  2013-04-30 21:01 ` Alex Efros
  2013-04-30 21:07 ` Jameson Graef Rollins
  0 siblings, 2 replies; 5+ messages in thread
From: Raymond Barlow @ 2013-04-30 19:43 UTC (permalink / raw)
  To: supervision

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

Hi,

Logging:

* Do you need to create 2 run scripts (/etc/sv/myservice/run,
/etc/sv/myservice/log/run)? Or does the log/run supersede the myservice/run
script?
* The directory specified in the log run script to svlogd (eg ./main)--does
this live in the log directory?
* Do I need to create the log directory or does the svlogd directory do
that for me
* Where does the log go? I've looked in this main directory, and it is
still empty.

Cheers!

/Raymond

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: runit logging questions
  2013-04-30 19:43 runit logging questions Raymond Barlow
@ 2013-04-30 21:01 ` Alex Efros
  2013-04-30 21:07 ` Jameson Graef Rollins
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Efros @ 2013-04-30 21:01 UTC (permalink / raw)
  To: supervision

Hi!

On Tue, Apr 30, 2013 at 08:43:10PM +0100, Raymond Barlow wrote:
> Logging:

I think if you just try to use it you'll get all answers, and faster than
waiting for replies in list.

> * Do you need to create 2 run scripts (/etc/sv/myservice/run,
> /etc/sv/myservice/log/run)? Or does the log/run supersede the myservice/run
> script?

You need 2 run scripts.

> * The directory specified in the log run script to svlogd (eg ./main)--does
> this live in the log directory?

I think relative path will be relative to service's ./log/ directory with
run script - don't think svlogd will do any magic path mangling here, it
should work just like in any other app.
I'm using absolute paths to /var/log/service_name/.

> * Do I need to create the log directory or does the svlogd directory do
> that for me

You have to create it. And set directory permissions. And, usually, put
./config file into that directory to configure log rotation. Yep, a lot of
work.

I remember in daemontools were some helper tools which help you create and
configure new service and may do this for you, but I didn't used them for
years so not really sure.

> * Where does the log go? I've looked in this main directory, and it is
> still empty.

If you didn't see ./current log file in log directory then svlogd probably
doesn't run (service not started or svlogd can't start because of wrong
params or log directory permissions).

-- 
			WBR, Alex.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: runit logging questions
  2013-04-30 19:43 runit logging questions Raymond Barlow
  2013-04-30 21:01 ` Alex Efros
@ 2013-04-30 21:07 ` Jameson Graef Rollins
  2013-05-01 12:41   ` Raymond Barlow
  1 sibling, 1 reply; 5+ messages in thread
From: Jameson Graef Rollins @ 2013-04-30 21:07 UTC (permalink / raw)
  To: Raymond Barlow, supervision

[-- Attachment #1: Type: text/plain, Size: 877 bytes --]

On Tue, Apr 30 2013, Raymond Barlow <rbarlow@raymanoz.com> wrote:
> Logging:
>
> * Do you need to create 2 run scripts (/etc/sv/myservice/run,
> /etc/sv/myservice/log/run)? Or does the log/run supersede the myservice/run
> script?

The run and log/run scripts are completely distinct.  The run script is
for exec'ing the actual supervised process, and the log/run script is
for exec'ing the corresponding svlogd process.

> * The directory specified in the log run script to svlogd (eg ./main)--does
> this live in the log directory?

Yes: log/main/

> * Do I need to create the log directory or does the svlogd directory do
> that for me

Usually the log/run script creates it if it doesn't exist.

Pretty much all of my services use this same log/run script:

#!/bin/sh
set -e
LOG=$(readlink -f ./main)
test -d "$LOG" || mkdir -p -m0750 "$LOG"
exec svlogd -tt "$LOG"

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: runit logging questions
  2013-04-30 21:07 ` Jameson Graef Rollins
@ 2013-05-01 12:41   ` Raymond Barlow
  2013-05-01 13:08     ` Alex Efros
  0 siblings, 1 reply; 5+ messages in thread
From: Raymond Barlow @ 2013-05-01 12:41 UTC (permalink / raw)
  To: Jameson Graef Rollins; +Cc: supervision

[-- Attachment #1: Type: text/plain, Size: 2102 bytes --]

Hi guys,

Thanks both of you for your help. I finally found out what the root cause
of problems was.

I did this in this order:
1. Created the service directory
2. Symlink it to tell runit about the new service
3. Created the log directory

At this point, no matter how many times I started/stopped the service,
logging was not kicking in.

I needed to remove the symlink created in (2), and recreate it. Then, hey
presto, it was all working beautifully!

FWIW--I didn't understand the key concept that runit was monitoring the
service directory and looking for new symlinks to be created.

Also, as a side note, in the FAQ for logging, it seems that the service
that is being started is another logging tool (socklog-klog). This in
itself was confusing for me, as it wasn't clear if this logging was part of
the runit logging, or if it was just the service. So I guess what I'm
saying here is maybe the documentation should be changed to log a different
kind of process so it is clear what part of the script is required for
logging and what is just other stuff.

Cheers,
Raymond




On 30 April 2013 22:07, Jameson Graef Rollins <jrollins@finestructure.net>wrote:

> On Tue, Apr 30 2013, Raymond Barlow <rbarlow@raymanoz.com> wrote:
> > Logging:
> >
> > * Do you need to create 2 run scripts (/etc/sv/myservice/run,
> > /etc/sv/myservice/log/run)? Or does the log/run supersede the
> myservice/run
> > script?
>
> The run and log/run scripts are completely distinct.  The run script is
> for exec'ing the actual supervised process, and the log/run script is
> for exec'ing the corresponding svlogd process.
>
> > * The directory specified in the log run script to svlogd (eg
> ./main)--does
> > this live in the log directory?
>
> Yes: log/main/
>
> > * Do I need to create the log directory or does the svlogd directory do
> > that for me
>
> Usually the log/run script creates it if it doesn't exist.
>
> Pretty much all of my services use this same log/run script:
>
> #!/bin/sh
> set -e
> LOG=$(readlink -f ./main)
> test -d "$LOG" || mkdir -p -m0750 "$LOG"
> exec svlogd -tt "$LOG"
>
> jamie.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: runit logging questions
  2013-05-01 12:41   ` Raymond Barlow
@ 2013-05-01 13:08     ` Alex Efros
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Efros @ 2013-05-01 13:08 UTC (permalink / raw)
  To: supervision

Hi!

On Wed, May 01, 2013 at 01:41:32PM +0100, Raymond Barlow wrote:
> I needed to remove the symlink created in (2), and recreate it. Then, hey
> presto, it was all working beautifully!

Actually, it should be enough to `sv x .` - it signal runsv to exit, then
few seconds later it will be started for this service directory again by
runsvdir, but this time it'll see ready ./log/run and start it too.

-- 
			WBR, Alex.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-01 13:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-30 19:43 runit logging questions Raymond Barlow
2013-04-30 21:01 ` Alex Efros
2013-04-30 21:07 ` Jameson Graef Rollins
2013-05-01 12:41   ` Raymond Barlow
2013-05-01 13:08     ` Alex Efros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).