Commit Graph

103 Commits

Author SHA1 Message Date
Tobias Deiminger eb8f67335e Define SD_JOURNAL_SUPPRESS_LOCATION more locally
add_definitions would set SD_JOURNAL_SUPPRESS_LOCATION for all targets
in directory and sub-directories. However, another future target might
want the opposite, so define it as local as possible to journaldlogger.cpp.

To make this work, we must take journaldlogger.cpp out of the unity
build, because all files from a unity of share compiler definitions.
2021-09-23 16:08:39 +02:00
Tobias Deiminger 173caa42aa Add a JournaldLogger
As proposed in #8857, this adds a Logger subclass that writes structured
log messages via journald's native protocol by calling sd_journal_sendv.
The feature therefore depends on the systemd library. sd_journal_sendv is
available since the early days (systemd v38), so a version check is
probably superflous.

We add the following fields to each record:
- MESSAGE: The log message
- PRIORITY (aka severity): Numeric severity as in RFC5424 section 6.2.1
- SYSLOG_FACILITY: Numeric facility as in RFC5424 section 6.2.1
- SYSLOG_IDENTIFIER: If provided, use value from configuration.
  Else use systemd's default behaior, which is to determine the field
  by using libc's program_invocation_short_name, resulting in "icinga2".
- ICINGA2_FACILITY: Facility as in Log::Log(..., String facility, ...),
  e.g. "ApiListener"
- some more fields are added automatically by systemd

Fields are stored indexed, so we can do fast queries for certain field
values. Example:

$ journalctl -t icinga2 ICINGA2_FACILITY=ApiListener -n 5

Syslog compatiblity is ratained because good old tag, severity and facility
is stored along, and systemd can forward to syslog daemons.

See also https://systemd.io/JOURNAL_NATIVE_PROTOCOL/.
2021-09-23 16:08:11 +02:00
Julian Brost 6de9f58810 Add WindowsEventLogLogger 2021-06-21 15:15:54 +02:00
Alexander A. Klimov 070b4f9d06 Drop StringBuilder 2021-03-23 13:13:47 +01:00
Julian Brost 3f15963651 Remove SpinLock
No longer needed as its only user now uses std::mutex.
2020-11-17 09:40:34 +01:00
Alexander A. Klimov 4af450141b Introduce SpinLock 2020-10-14 10:47:08 +02:00
Alexander A. Klimov 4438ccbf9e Introduce SharedObject
refs #7361
2019-10-21 17:10:51 +02:00
Alexander A. Klimov b046ffe152 Introduce Shared<T> 2019-10-21 11:07:42 +02:00
Alexander A. Klimov c385355c38 DaemonCommand: make the atomics a bit more atomic
Just to be sure.

refs #5230
2019-07-16 11:39:09 +02:00
Michael Friedrich 5dbb6ad366 Quality: Remove old SocketEvent functionality 2019-05-24 15:50:43 +02:00
Alexander A. Klimov c547e9a863 Implement basic I/O engine 2019-04-01 11:40:14 +02:00
Alexander A. Klimov 7c7c5e28f5 Implement LazyInit<T> 2019-04-01 11:40:14 +02:00
Michael Friedrich 458f997a18 Replace Copyright header with a short version, part II 2019-02-25 15:09:36 +01:00
Alexander A. Klimov 61860563a6 Make string builder reusable 2018-12-21 12:43:04 +01:00
Michael Friedrich dea5ec614e icinga.com: Update CMakeLists.txt 2018-10-18 09:35:18 +02:00
Gunnar Beutner e678fa1aa5 Refactor Application::*Const() 2018-08-13 15:27:05 +02:00
Gunnar Beutner 1a8692d972 Implement support for namespaces 2018-08-13 13:44:31 +02:00
Michael Friedrich 97513965e6 Introduce IcingaApplication#environment
Precedence as follows:

- DEnvironment=...
- const Environment = ...
- object IcingaApplication "app" { environment = "..." }

The wrapped script constant handling is required
since we cannot directly link from libremote (SNI handling)
to libicinga where the object resides. Instead we'll
use the Application class helpers for hiding the ScriptGlobal
calls.
2018-08-10 12:49:48 +02:00
Markus Frosch 9fbc40615a Improve path handling in cmake and daemon 2018-08-07 14:10:26 +02:00
Gunnar Beutner 8bfd419702 Implement references 2018-08-07 07:44:48 +02:00
Alexander A. Klimov dd8cb42969 Implement object packer for consistent hashing 2018-07-26 17:36:48 +02:00
Jean Flach 01c7f20170 Require systemd headers
Only mandatory if using systemd
2018-02-27 15:54:58 +01:00
Jean Flach 1da6b2c883 Fix whitespaces in CMakeLists files
Uses 2 space indentation as standard
2018-01-19 09:19:40 +01:00
Gunnar Beutner 9d436605f0 Fix compatibility with CMake < 3.1 2018-01-18 15:12:46 +01:00
Gunnar Beutner 2a9dceb367 Use CMake object libraries for our libs 2018-01-17 04:28:21 +01:00
Gunnar Beutner 75e2473616 Clean up source lists in the CMakeLists.txt files 2018-01-03 11:47:46 +01:00
Gunnar Beutner fe8572d75b Remove inline methods and use explicit template instantiation to minimize the number of weak symbols 2018-01-03 11:04:58 +01:00
Gunnar Beutner 2f953d6204 Implement shim for libmysqlclient and libpq 2018-01-02 23:29:48 +01:00
Gunnar Beutner 90496b5456 Build libraries as static libraries 2018-01-02 23:29:48 +01:00
Michael Insel 158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Gunnar Beutner a344f11e6c Replace StatsFunction with Function 2017-11-30 19:02:25 +01:00
Gunnar Beutner d5961bb76c Re-implement WrapFunction() using C++11 features 2017-11-29 11:53:45 +01:00
Michael Friedrich d74b15d640 Move Base64 class into libbase
refs #5538
2017-09-11 16:51:13 +02:00
Michael Friedrich 52d986d02b Revert "Add LogstashWriter feature"
This reverts commit f5a971f5b0.

refs #4054
2017-05-23 12:05:01 +02:00
Michael Friedrich 79dcb789c2 Move PerfdataValue() class into base library
This is required for libremote and ApiListener stats in #5133
2017-05-15 16:32:29 +02:00
Kai Goller f5a971f5b0 Add LogstashWriter feature
This adds the UdpSocket class.

refs #4054
2017-03-20 14:30:03 +01:00
Michael Friedrich b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Gunnar Beutner 30762e5330 Set versions for all internal libraries
fixes #12552
2016-08-25 17:56:18 +02:00
Gunnar Beutner ae1ab5f865 Implement unit tests for state changes
fixes #12530
2016-08-24 19:45:52 +02:00
Gunnar Beutner 54bbaf9f7d Implement support for marking functions as deprecated
fixes #12393
2016-08-10 15:48:05 +02:00
Gunnar Beutner d8b0502d67 Make the socket event engine configurable
fixes #11522
2016-04-18 14:38:59 +02:00
Gunnar Beutner eb0892273e Implement the DateTime class
fixes #9839
2016-03-29 13:27:20 +02:00
Gunnar Beutner 599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Gunnar Beutner e3c75faabc Implement support for recursive object locks
fixes #10596
2015-11-11 10:21:30 +01:00
Gunnar Beutner 701961b73b Fix the 'type' attribute for the Object class
refs #10387
2015-11-05 10:29:02 +01:00
Gunnar Beutner dd77863910 Implement Array::ToString and Dictionary::ToString
fixes #10329
2015-10-26 11:05:24 +01:00
Gunnar Beutner c37a23ccba Implement the Icinga Studio application
fixes #10042
2015-08-31 07:50:01 +02:00
Gunnar Beutner f45f6ccd82 Implement support for tracking dependencies between config objects
refs #9096
2015-08-25 13:54:05 +02:00
Gunnar Beutner 071d2f18fb Rename DynamicObject/DynamicType to ConfigObject/ConfigType
fixes #9914
2015-08-15 20:40:41 +02:00
Michael Friedrich d7970f5bb1 Implement modified attributes v2
refs #9081
refs #9093
2015-08-15 20:07:10 +02:00