GithubHelp home page GithubHelp logo

Comments (6)

jue89 avatar jue89 commented on August 22, 2024

Hey Bryan!

Thanks for your thoughts and PR! I am delighted that other people are participating to this module :)

I actually discovered this problem before and finally named my node processes in the systemd unit files. But I know this is just a solution for daemons. And not a very good one as well.

I can confirm that your proposed solution works. But (Don't get me wrong!) I don't like the way how the identifier ist set. I think it is not a good habit to hold a state globally in the module. It may interfere if it is used by several other modules independently.

When I first discovered that process.title is not the best solution to set the identifier, I thought about a breaking change to the API (resp. releasing version 2.0.0). This way every module using node-systemd-journald can hold their very own instance. See my example code:

const Jorunald = require( 'systemd-journald' );

// Create an instance of Journald for logging.
// The parameter holds an object containing default fields. They may be overwritten by logging calls.
// Of course it can have other default fields than just the syslog_identifier.
const log = new Journald( { syslog_identifier: 'foobar' } );

log.debug( ... );

What do you think?

from node-systemd-journald.

bryanburgers avatar bryanburgers commented on August 22, 2024

Ha! I actually had a very similar example to that in my initial issue, but then removed it because I wasn't sure if you'd like a breaking version change. I like that direction.

Also, I am doing systemd daemons, and would be curious to see how you set it in your systemd file.

from node-systemd-journald.

jue89 avatar jue89 commented on August 22, 2024

I don't have problems with breaking changes at all. I try do my very best to stick with semantic versioning. If everybody else would do that, we all do not have to concern about breaking changes.
But before we do these changes, I'm going to warn the winston-systemd guys - they are requiring the lastest version of this module and ignore semantic versioning ;)

According to the systemd.exec docu just add SyslogIdentifier=foobar to the [Service] section.

from node-systemd-journald.

jue89 avatar jue89 commented on August 22, 2024

Implementation in PR #8

from node-systemd-journald.

bryanburgers avatar bryanburgers commented on August 22, 2024

I'm surprised the SyslogIdentifier works when using this module. https://lists.freedesktop.org/archives/systemd-devel/2015-June/032816.html seems to suggest that SyslogIdentifier only works when outputting to stdout or stderr, not when using sd_journal_(print|send).

I couldn't get it to work on systemd 229 (Ubuntu 16.04.1).

from node-systemd-journald.

jue89 avatar jue89 commented on August 22, 2024

Sry, wasn't feeling well the last days. Merge will happen today.

Yes, you are right. I was wrong. Tested it and failed, too.

from node-systemd-journald.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.