Comments (6)
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.
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.
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.
Implementation in PR #8
from node-systemd-journald.
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.
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)
- Fails to install on Mint 17.3 HOT 3
- Is it possible to merge this into `systemd/node-systemd`? HOT 3
- Fields are modified if message is an instance of Error
- Display instances of Buffer in a nice way
- Display NULL instead of just ignoring it?
- Typescript definitions HOT 2
- Expose log command HOT 1
- Move to N-API to support future node versions HOT 4
- How do you read journald without calling sd_journal_open? HOT 2
- Should use priority string if converting to integer fails HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-systemd-journald.