Jump to content

syslog and journalctl


NotionCommotion

Recommended Posts

My typical approach to logging is as follows:

openlog('PublicAPI', LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER | LOG_PERROR);
syslog(LOG_INFO, 'some info');
syslog(LOG_ERR, 'some error');

And then when debugging script, I just use the following:

journalctl -f -uphp73-php-fpm -uphp-fpm -ureact_php_systemctl_service

While it works okay, often I get more content shown by journalctl that I would like.  Another downfall is segfaults are not displayed, and the only way I have been able to view them is by not including a systemd unit (i.e. -u) and just using journalctl -f, but then I get way more content that I desire.

Recently, I was running some script and none of my units (i.e. -uphp73-php-fpm -uphp-fpm -ureact_php_systemctl_service) filtered it.

I then tried journalctl -f | grep PublicAPI, and while it worked, errors didn't show as red and I expect it just isn't the right way to do it.

Next I tried journalctl -ft PublicAPI, and it seemed like a better approach.

How should I be doing this?  How can I filter just segfaults when something is not going right?  Should I be filtering by unit and how can I identify what unit to use?  Is a better approach to filter by user (not sure if possible)?

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.