Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to log via syslog for daemons #185

Merged
merged 4 commits into from
Aug 15, 2024
Merged

add support to log via syslog for daemons #185

merged 4 commits into from
Aug 15, 2024

Conversation

hannesm
Copy link
Collaborator

@hannesm hannesm commented Aug 12, 2024

This is especially useful for albatross-tls-endpoint in inetd mode, where stdout is occupied with client communication

Fixes #176

This is especially useful for albatross-tls-endpoint in inetd mode, where stdout
is occupied with client communication
@hannesm
Copy link
Collaborator Author

hannesm commented Aug 12, 2024

maybe @reynir has an opinion on this... otherwise I'll merge once CI is fine :)

@reynir reynir self-requested a review August 12, 2024 10:15
daemon/albatrossd_utils.ml Outdated Show resolved Hide resolved
@@ -166,7 +166,7 @@ let ip =
Arg.(value & opt ip_c Ipaddr.(V6 V6.unspecified) & info [ "ip" ] ~doc)

let inetd =
let doc = "Inetd mode" in
let doc = "Inetd mode. Be sure to use `--syslog` (or `--quiet` to disable logging)" in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it perhaps worth it to check this is the case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would c12a53f be fine in that regard? The issue is that you'll only see exit code 3... since the tls-endpoint binary is only ever called by inetd where stdout (and stderr I believe) are not available anymore...

So, actually I'm not sure whether it is worth to have this check in the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this opens another can of worms. If you pass invalid flags/arguments to albatross-tls-endpoint I think cmdliner will print out help messages?! I think to stderr. If so then that's as well problematic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe another approach is to have a albatross-tls-endpoint-inetd that is a symlink to albatross-tls-endpoint and match on Sys.argv.(0) to determine if we're -inetd and then pass to Cmdliner.Cmd.eval null formatters ~help and ~err and set inetd mode.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't overengineer this. :) Given that for e.g. Linux and systemd we have the socket activation, the inetd mode is mostly a relict for our FreeBSD server :)

@hannesm hannesm merged commit f35a669 into main Aug 15, 2024
17 checks passed
@hannesm hannesm deleted the syslog-support branch August 15, 2024 20:04
hannesm added a commit to hannesm/opam-repository that referenced this pull request Aug 15, 2024
CHANGES:

* BUGFIX install tls_endpoint as systemd service (not only as example), fix typo
  (robur-coop/albatross#183 @PizieDust)
* BUGFIX albatross-influx: use "cow_faults" (fixed typo in robur-coop/albatross#182) as unsigned
  integer (b9695dd9c267f5e59f18154a632adba0481f9d72, @hannesm)
* BUGFIX albatross-influx: avoid empty measurement (robur-coop/albatross#182 @hannesm)
* BUGFIX tls-endpoint: don't fail if a bad client connects (robur-coop/albatross#180 @hannesm)
* FEATURE tls-endpoint: add syslog support (esp. useful for inetd) (robur-coop/albatross#185 @hannesm)
* FEATURE Update to FreeBSD 14 (robur-coop/albatross#172, @hannesm)
* BUGFIX update command: make usable with local client (robur-coop/albatross#184, @reynir)
* BUGFIX update command: handle HTTP not found explicitly
  (fixes robur-coop/albatross#147, robur-coop/albatross#171 @hannesm)
* FEATURE Albatross: record start timestamp via info (fixes robur-coop/albatross#168, robur-coop/albatross#169 @hannesm)
* BUGFIX Albatross: store timestamp as generalized time instead of utc time
  (robur-coop/albatross#167 @hannesm @reynir, adjusted by robur-coop/albatross#181 for backwards compatibility
   @PizieDust)
* BUGFIX FreeBSD: restart services when they terminate
  (@hannesm, 64f28fbd88504ec33d6bfde5211684e0ba1bc193)
* BUGFIX packaging: install albatross-client as albatross-client
  (@hannesm, 23acb8b3edbe0153e1bd24a1736b80e73a27e33f)
* update nix inputs (robur-coop/albatross#175, robur-coop/albatross#179 @Julow)
* use ohex instead of hex (robur-coop/albatross#174 @hannesm)
* fix README (robur-coop/albatross#177 @PizieDust, 2a1c3d898b586946ce7c4f3171ea5eb856f4ade8,
  107c235eb94e83d6a077c42ee8b527c207af4ba7)
avsm pushed a commit to avsm/opam-repository that referenced this pull request Sep 5, 2024
CHANGES:

* BUGFIX install tls_endpoint as systemd service (not only as example), fix typo
  (robur-coop/albatross#183 @PizieDust)
* BUGFIX albatross-influx: use "cow_faults" (fixed typo in robur-coop/albatross#182) as unsigned
  integer (b9695dd9c267f5e59f18154a632adba0481f9d72, @hannesm)
* BUGFIX albatross-influx: avoid empty measurement (robur-coop/albatross#182 @hannesm)
* BUGFIX tls-endpoint: don't fail if a bad client connects (robur-coop/albatross#180 @hannesm)
* FEATURE tls-endpoint: add syslog support (esp. useful for inetd) (robur-coop/albatross#185 @hannesm)
* FEATURE Update to FreeBSD 14 (robur-coop/albatross#172, @hannesm)
* BUGFIX update command: make usable with local client (robur-coop/albatross#184, @reynir)
* BUGFIX update command: handle HTTP not found explicitly
  (fixes robur-coop/albatross#147, robur-coop/albatross#171 @hannesm)
* FEATURE Albatross: record start timestamp via info (fixes robur-coop/albatross#168, robur-coop/albatross#169 @hannesm)
* BUGFIX Albatross: store timestamp as generalized time instead of utc time
  (robur-coop/albatross#167 @hannesm @reynir, adjusted by robur-coop/albatross#181 for backwards compatibility
   @PizieDust)
* BUGFIX FreeBSD: restart services when they terminate
  (@hannesm, 64f28fbd88504ec33d6bfde5211684e0ba1bc193)
* BUGFIX packaging: install albatross-client as albatross-client
  (@hannesm, 23acb8b3edbe0153e1bd24a1736b80e73a27e33f)
* update nix inputs (robur-coop/albatross#175, robur-coop/albatross#179 @Julow)
* use ohex instead of hex (robur-coop/albatross#174 @hannesm)
* fix README (robur-coop/albatross#177 @PizieDust, 2a1c3d898b586946ce7c4f3171ea5eb856f4ade8,
  107c235eb94e83d6a077c42ee8b527c207af4ba7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

tls-inetd merged with tls-endpoint should be nicer
2 participants