Commit Graph

141 Commits

Author SHA1 Message Date
avjarami f5114e9b36 Docs for new features
* Added brief description of new configuration values.
* Documenting new header.
* Describing use of features for local debug.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-04-09 21:03:31 -07:00
avjarami 03fbd65fbd Release v1.16.0
This release contains:

* record_retention_enabled configuration key: when configuration value
  is enabled copies of the last 100 telemetry record payload are kept
  locally.

* record_server_delivery_enabled configuration key: when this key is
  set to true (default value) records are reported to server. When key
  is set to false records are not sent. This configuration can be used
  with record_retention_enabled to retain debug information locally
  only.

* A new switch (-i/--include_record) for 'telemctl journal' command,
  this switch allows the inclusion of record contents when printing
  journal to standard output.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
v1.16.0
2018-03-23 10:22:49 -07:00
avjarami d1f11980be Record retention feature
This change contains:

* New configuration keys: record_retention_enabled and
  record_server_delivery_enabled. These keys are needed to control
  remote delivery of records and record retention. These keys are
  optional to preserve backward compatibility with existing custom
  configurations.

* Record copy implementation. This change allows to save copies of
  records locally when feature is enabled in configuration. This
  operation is independent of record spooling and record reporting
  to remote server.

* New telem_journal argument to allow record payload print from
  local copy (if it exists).

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-23 10:07:47 -07:00
avjarami d75e27a5c4 Fixing memory leaks
This change fixes memory leaks present in journal printing command line
interface and journal printing api.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
v1.15.1
2018-03-14 06:22:59 -07:00
avjarami 9baf5f821e Use shared random id function
Random id generation function in telemetry.c is equivalent to function
in util.c, this change reuses the function defined in util.c in
telemetry.c and removes the no longer needed function.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-14 06:22:59 -07:00
avjarami be98da141d Add items to ignore list
Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-14 06:22:59 -07:00
avjarami 55bb762479 Release v1.15.0
This release contains:

* A new header event_id, this value can be used by a probe or probes to
  group multiple records when these records are the result of a unique
  event in the system, i.e. an update could create multiple records and
  these records could be tagged with a single event id.

* Telemetry record logging, this change adds a log of records reported
  to telemetry server. The log can be accessed using telemctl journal
  sub-command.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
v1.15.0
2018-03-12 15:13:26 -07:00
avjarami be78434f2c journal dir creation
Adding entry to template for journal directory

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-12 14:45:42 -07:00
avjarami 8edd75df21 Running uncrustify
Fixing syntax and indentation inconsistencies.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-12 14:30:11 -07:00
avjarami dc4f4e67e4 Addressing review
Addressing comments from first code review and fixing travis-ci
check_journal error in prune test.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-09 13:16:34 -08:00
avjarami 41e9090dd8 Refactoring tests to use fixture
Using fixture for event id tests instead of creating a new record for
every event id test.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-09 13:16:34 -08:00
avjarami cbcc5e24d5 Tests for journal feature
Adding tests for journal exported functions.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-09 13:16:34 -08:00
avjarami 4a9d8212c8 Basic record journaling
This change adds a logging mechanism for records submitted to telemetry
client. A basic journal is added to keep track of the last 100 valid
records that the daemon processed.

This journal can be queried by a new command line interface that was
added as part of the change 'telem_journal'.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-03-09 13:16:34 -08:00
avjarami 8a9dbc7528 Adding event_id header
* An event_id header is needed to group records when multiple records
  are generated by same event.

* Adding new available parameter to telem_record_gen, making possible
  for this utility to tag multiple records with same event_id.

Signed-off-by: avjarami <alex.v.jaramillo@intel.com>
2018-02-28 21:54:46 -08:00
Alex Jaramillo da45642759 Release v1.14.3
This release contains:

* Fixes an issue where if the telemetry client bundle is added after
  installation required directories were not created until the OS is
  restarted. This change makes sure that all the required directories
  are created before the telemd service is started.

* Adds an option to telemctl to indicate if telemd.service is active.

* Removes telemetry client temporary directories on telemetry opt-out.

* Add a base64 encoding routine to the nica library, this library can
  be used by probes to encode binaries for http transport to telemetry
  server.

* Fixes configuration parameter on hprobe.

* Adds a probe to report Boot Error Region Table if this record exists
  for more information about BERT, consult ACPI spec
v1.14.3
2018-01-08 18:02:28 +00:00
avjarami ed1c85a481 Fixing config parameter in probe
hprobe had an error in the short forme of the CLI config_file parameter,
this change fixes the error.
2018-01-05 13:33:25 -08:00
avjarami b4ac36f7a6 Addresing review comments 2018-01-04 17:44:59 -08:00
avjarami 2f07fd658c BERT record probe
Telemetry probe to report Boot Error Region Table if such entry exists
in /sys/firmware/acpi/tables/
2018-01-04 17:44:59 -08:00
avjarami 4b10dbec86 Base 64 encoding implementation
Providing a minimal function to encode data in base64 to allow the
use of binary data as printable (http transportable) characters.
2018-01-02 13:44:31 -08:00
avjarami bc3c7b6a4d Improvements to telemctl
* Using variable instead of literal

* Simplifying filter that removes folders listed in configuration file
2017-12-07 16:01:01 -08:00
avjarami 15d32841f0 Remove work dirs on opt-out
This change removes working directories when the user opt-out of
reporting platform telemetry.
2017-12-07 16:01:01 -08:00
avjarami e3178e1624 Adding is-active option to telemctl
This change adds a simple way to determine if telemd.service is active.
2017-12-07 16:01:01 -08:00
avjarami 7de4351f16 Create working directries on start
telemd will not start or function properly if expected directories are
not present (i.e. spool dir), this change calls systemd-tempfiles to
create dirs listed listed in telemetrics-dirs.conf
2017-12-07 16:01:01 -08:00
Patrick McCarty 73adb8981a Fix compiler warning
`readv` is declared in <sys/uio.h>

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-10-27 10:26:44 -07:00
Alex Jaramillo 5ead074c89 Release v1.14.2
This release adds a unit file to make sure that telemetry daemon will
restart when swupd performs an update.
v1.14.2
2017-10-16 18:42:52 +00:00
Alex Jaramillo 80292b5bf8 Restart on update
Because telemd does not restart when an update is installed the daemon
could get out of sync with probes if a new version of a probe requires a
new version of telemd. This change will trigger a restart when an update
takes place.
2017-10-11 17:44:32 -07:00
Patrick McCarty 1517ff4c18 Fix build issues when -DDEBUG is enabled
The call to "fprint()" is a typo and should be "fprintf()".

Also, the "error->message" string is an artifact from the time when
telemetrics-client used glib. Now it uses libnica, which propogates
errors differently. Simply remove the format specifier for now.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-09-29 15:12:03 -07:00
Patrick McCarty 85772cb5c5 Release v1.14.1
This release bumps the record format version to account for the new
headers added in the v1.14.0 release.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v1.14.1
2017-09-15 10:54:18 -07:00
Patrick McCarty d75fa6fda2 Link to telemetrics-backend repo from the README
Because the telemetrics-backend repo is now hosted on Github, link to it
from the client README, since it is part of a complete telemetrics
solution.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-09-15 10:53:09 -07:00
avjarami 6c7c5be2e2 Bumping record format version to 3 2017-09-15 10:52:19 -07:00
Patrick McCarty 913cbb1c1e Release v1.14.0
This release adds three new hardware metadata fields to include in
records created by libtelemetry: board_name, cpu_model, and
bios_version.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v1.14.0
2017-09-08 07:32:13 -07:00
Patrick McCarty d3ce2f435c Run uncrustify on the source
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-09-08 07:28:42 -07:00
avjarami d0a3e6bafa Including additional host metadata in headers
Additional headers added: board_name, cpu_model, and bios_version.

    * Board name is a combination of board_name and board_vendor from
    dmi file system.

    * CPU model is read from /proc/cpuinfo.

    * BIOS version is taken from dmi file system.
2017-09-08 07:26:01 -07:00
Patrick McCarty a9b16868f5 Release v1.13.0
This release introduces some changes in behavior for the crash probe and
journal probe:

* The crash probe now ensures core files are kept whenever backtraces
  are scrubbed from telemetry records, or when errors occur during runtime
  operation. This improves the developer experience when running ones own
  programs installed at arbitrary locations on the filesystem and also
  avoids data loss; either the crash backtrace is sent via telemetry, or
  when unable to send the backtrace, the core file is kept.

* The journal probe, by default, now only sends telemetry for journal
  log messages indicating systemd service failures. The previous behavior
  of sending any log messages above a certain log level is now wrapped
  behind the "opt-in-no-privacy-filters" config setting.

Bug fixes include:

* Fixing a segfault crash in the configuration code that occurred
  whenever an incomplete configuration file was encountered.

* Fixing a performance issue in 'telem-record-gen' to avoid extraneous
  strlen() calls in the classification input validation code.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v1.13.0
2017-07-05 12:02:21 -07:00
Patrick McCarty cbbc579917 journal probe: conditionally enable log level filters
Because log messages from services contain arbitrary data, and sometimes
this data is privacy sensitive, only enable the log level filters when
the privacy filter override is in effect.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-30 14:33:31 -07:00
Patrick McCarty 7080839167 configuration: make config errors more actionable
The current behavior of the configuration code is to print a generic
error message and exit if configuration parsing fails.

To clarify the reason for exiting, and thus make the error message more
actionable, print an additional error message that describes which key
from the config is affected and the type of value it accepts.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-30 14:31:53 -07:00
Patrick McCarty 0d07e76955 configuration: fix regression in parsing that results in segfault
When a key from a INI file is missing, libnica returns NULL, so we need
to properly check for a non-NULL return value before passing it to
strdup().

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-30 14:31:53 -07:00
Patrick McCarty 1c8af05cb9 telem-record-gen: avoid unnecessary strlen() calls
Since strlen(opt_class) is already called before this for loop, there is
no need to call it again. It also avoids repeatedly calling strlen() as
part of the for-loop conditional check.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-27 21:02:44 -07:00
Patrick McCarty cb4b951a1a crash probe: use a helper function for string prefix checks
Since the code repeats the same logic in several places, it is
convenient to split the routine into a helper function, startswith().

This also fixes a bug with the earlier port to libnica: in the
in_clr_build() function, strstr() was chosen as the replacement function
instead of strncmp(), which means a match will be found in any part of
the string. However, a match should only be found when it is a prefix.
To fix, switch the strstr() in that function to use startswith() as
well.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-27 21:02:44 -07:00
Patrick McCarty bb018a158f Document condition under which core files are removed
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-26 17:14:50 -07:00
Patrick McCarty 577484cdb2 crash probe: also keep core files when errors occur
During the processing of a core file or sending telemetry, any numbers
of errors may occur. Make sure the core file is not unlinked under these
conditions.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-26 17:14:50 -07:00
Patrick McCarty 049c9a35b9 crash probe: keep core files when backtraces are scrubbed
When the path filters for privacy are in effect, backtraces are scrubbed
from records, and this results in the core files being unlinked.

However, this is not friendly behavior for the developer. A common
situation that triggers the path filters is installing custom binaries
on the system (say, under /usr/local/bin or /opt/bin) for testing
purposes. To better enable developers to debug their programs, having
the core files available to process with gdb is very valuable.

Eventually, I would like to add an opt-in to keep all core files, but
I'll wait until the configuration code is refactored.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-26 17:14:50 -07:00
Patrick McCarty 56a6a4777b Release v1.12.4
This release includes a change that results in lower memory consumption
for telemd when the service is idle.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v1.12.4
2017-06-23 11:16:07 -07:00
Patrick McCarty d2ecf76c70 Init/deinit libcurl global environment for each POST
When the daemon is sitting idle, we are seeing libcurl consume around
2MB of memory, which had been previously allocated on-the-fly for its
global environment.

To have more control over this memory consumption, making sure the
daemon uses as little memory as possible when doing no work, explicitly
allocate the libcurl global environment before each POST and deallocate
it afterwards.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-20 19:33:06 -07:00
Patrick McCarty f2aa671513 Release v1.12.3
This release fixes a buffer overrun issue in the klogscanner.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v1.12.3
2017-06-20 15:41:00 -07:00
Patrick McCarty a1fcf14c3d Fix max number of bytes read by SYSLOG_ACTION_READ
In case the value returned by SYSLOG_ACTION_SIZE_BUFFER exceeds MAX_BUF,
the buffer later allocated has size MAX_BUF, but SYSLOG_ACTION_READ may
read more than MAX_BUF bytes to store in the buffer, leading to a buffer
overrun.

Fix the issue by ensuring SYSLOG_ACTION_READ reads at most "buflen"
bytes, the size of the allocated buffer.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-20 12:22:34 -07:00
Patrick McCarty ad8209115f Enforce buffer length cap on first loop iteration
Since loopsize is initialized to 0, the conditional statement where
loopsize increments led to the buffer size check not being executed the
first time through the loop.

Simply remove the counter variable to fix the issue.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-20 12:22:34 -07:00
Patrick McCarty fdb2fa0463 Print specific error for SYSLOG_ACTION_SIZE_BUFFER query failure
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-20 12:22:34 -07:00
Patrick McCarty 54b66b2820 Release v1.12.2
This release completes the remaining work to remove the glib dependency
in favor of libnica.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v1.12.2
2017-06-09 14:05:04 -07:00
Patrick McCarty bccd669c91 Remove buildtime checks for glib; update README
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-06-09 14:01:51 -07:00