Re: cephadm logs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday, July 28, 2023 11:51:06 AM EDT Adam King wrote:
> Not currently. Those logs aren't generated by any daemons, they come
> directly from anything done by the cephadm binary one the host, which tends
> to be quite a bit since the cephadm mgr module runs most of its operations
> on the host through a copy of the cephadm binary. It doesn't log to journal
> because it doesn't have a systemd unit or anything, it's just a python
> script being run directly and nothing has been implemented to make it
> possible for that to log to journald.


For what it's worth, there's no requirement that a process be executed 
directly by a specific systemd unit to have it log to the journal. These days 
I'm pretty sure that anything that tries to use the local syslog goes to the 
journal.  Here's a quick example:

I create foo.py with the following:
```
import logging
import logging.handlers
import sys

handler = logging.handlers.SysLogHandler('/dev/log')
handler.ident = 'notcephadm: '

h2 = logging.StreamHandler(stream=sys.stderr)

logging.basicConfig(
    level=logging.DEBUG,
    handlers=[handler, h2],
    format="(%(levelname)s): %(message)s",
)
log = logging.getLogger(__name__)

log.debug("debug me")
log.error("oops, an error was here")
log.info("some helpful information goes here")
```
I ran the above and now I can run:
```
$ journalctl   --no-pager -t notcephadm
Jul 29 14:35:31 edfu notcephadm[105868]: (DEBUG): debug me
Jul 29 14:35:31 edfu notcephadm[105868]: (ERROR): oops, an error was here
Jul 29 14:35:31 edfu notcephadm[105868]: (INFO): some helpful information goes 
here
```

Just getting logs into the journal does not even require one of the libraries 
specific to the systemd journal. Personally, I find centralized logging with the 
syslog/journal more appealing than logging to a file. But they both have their 
advantages and disadvantages.

Luis, I'd suggest that you should file a ceph tracker issue [1] if having 
cephadm log this way is a use case you would be interested in. We could also 
discuss the topic further in a ceph orchestration weekly meeting.


[1]: https://tracker.ceph.com/projects/orchestrator/issues/new

> 
> On Fri, Jul 28, 2023 at 9:43 AM Luis Domingues <luis.domingues@xxxxxxxxx>
> wrote:
> 
> 
> > Hi,
> >
> >
> >
> > Quick question about cephadm and its logs. On my cluster I have every
> > logs
> > that goes to journald. But on each machine, I still have
> > /var/log/ceph/cephadm.log that is alive.
> >
> >
> >
> > Is there a way to make cephadm log to journald instead of a file? If yes
> > did I miss it on the documentation? Of if not is there any reason to log
> > into a file while everything else logs to journald?
> >
> >
> >
> > Thanks
> >
> >
> >
> > Luis Domingues
> > Proton AG
> > _______________________________________________
> > ceph-users mailing list -- ceph-users@xxxxxxx
> > To unsubscribe send an email to ceph-users-leave@xxxxxxx
> >
> >
> >
> 
> _______________________________________________
> ceph-users mailing list -- ceph-users@xxxxxxx
> To unsubscribe send an email to ceph-users-leave@xxxxxxx



_______________________________________________
ceph-users mailing list -- ceph-users@xxxxxxx
To unsubscribe send an email to ceph-users-leave@xxxxxxx




[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux