platform/core/system/dlog.git
5 years agodlogfilterctl: allow dumping all rules 27/187927/4
Maciej Slodczyk [Wed, 29 Aug 2018 12:36:03 +0000 (14:36 +0200)]
dlogfilterctl: allow dumping all rules

Change-Id: I2f128778561b520a6cf8f8ac767ee8d5579c03d7
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoMinor fix on macro api alignment 01/187901/1
Hyotaek Shim [Wed, 29 Aug 2018 08:48:05 +0000 (17:48 +0900)]
Minor fix on macro api alignment

Change-Id: Ic8f63f1a5f0f231c0c5a23cf9fa59bad1415da92
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agoFix various SVACE static analysis warnings 64/187464/3 accepted/tizen/unified/20180831.061032 submit/tizen/20180829.051003
Michal Bloch [Wed, 22 Aug 2018 16:41:11 +0000 (18:41 +0200)]
Fix various SVACE static analysis warnings

Change-Id: I1ff2570548bab4e7877380633529ecdc7fafd22a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolimiter: add a config variable to apply limiter rules to all buffers 13/187813/1
Maciej Slodczyk [Tue, 28 Aug 2018 12:02:19 +0000 (14:02 +0200)]
limiter: add a config variable to apply limiter rules to all buffers

Change-Id: I59936632495031b5caee1e8d6ae7821f8b166bfb
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoRelease dlog 5.0.2 78/187678/1 submit/tizen/20180827.144207
Maciej Slodczyk [Mon, 27 Aug 2018 14:39:21 +0000 (16:39 +0200)]
Release dlog 5.0.2

- fix missing filters config file error

Change-Id: Ib9e3301cfe9c193b69e913cc22782ffe9b9646fe
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agofilters: don't treat missing config file on startup as an error 62/187662/1
Maciej Slodczyk [Mon, 27 Aug 2018 09:40:07 +0000 (11:40 +0200)]
filters: don't treat missing config file on startup as an error

Change-Id: I2cea1696d08100a9ad93414271fbf74ba935c867
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoRelease dlog 5.0.1 90/187590/1 accepted/tizen/unified/20180827.071503 submit/tizen/20180824.105725
Maciej Slodczyk [Fri, 24 Aug 2018 10:31:33 +0000 (12:31 +0200)]
Release dlog 5.0.1

New features:
- runtime filters configuration
- dlogutil sorting enhancements

Change-Id: I69bed93149a54bc5892f10407d93235a5faefda1
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoSort out default filters config file location 86/187586/2
Maciej Slodczyk [Fri, 24 Aug 2018 10:22:22 +0000 (12:22 +0200)]
Sort out default filters config file location

Change-Id: I8d2c2ca9a491d8fb50bd639f209e46f3edf1eef6
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoImprove documentation 69/187469/2 submit/sorting/20180823.145108 submit/tizen/20180823.145725
Michal Bloch [Thu, 23 Aug 2018 11:07:00 +0000 (13:07 +0200)]
Improve documentation

Change-Id: I6359ddf9e578c49f891083cc3ff31abc7fb90c5c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: no sorting if not needed 48/185948/7
Michal Bloch [Fri, 3 Aug 2018 18:34:50 +0000 (20:34 +0200)]
util: no sorting if not needed

As long as the log source (the daemon, or Android Logger devices) sorts
logs, util does not have to.

Change-Id: I6262a29bc3db5ae2f43a3aac0a13f45deb215fec
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRelax sorting constraints 49/187449/2
Michal Bloch [Fri, 3 Aug 2018 18:34:50 +0000 (20:34 +0200)]
Relax sorting constraints

Use a similar timestamp if one is missing instead of
disallowing that sorting altogether.

Change-Id: I31415926535b5ae2f43a3aac0a13f45deb215fec
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: sort based on output format 47/185947/5
Michal Bloch [Fri, 3 Aug 2018 18:13:35 +0000 (20:13 +0200)]
util: sort based on output format

Different output formats use different timestamps.
Util now sorts according to desired format to make sure that
the timestamp shown is consistent.

Change-Id: I685fb209526117f7d17930c71fa751d5005ce803

5 years agoutil: format out of order message as a log entry 90/185790/4
Maciej Slodczyk [Thu, 2 Aug 2018 09:18:33 +0000 (11:18 +0200)]
util: format out of order message as a log entry

To prevent SDK log parsers errors, when an out of
order message is printed, it has to be formatted
in the same way as other entries.

Change-Id: I004bb4a3d1dc58b1a81f80e668efe71f07987bdf
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoutil: use dynamic timestamp-oriented functions 45/185945/3
Michal Bloch [Wed, 1 Aug 2018 13:02:40 +0000 (15:02 +0200)]
util: use dynamic timestamp-oriented functions

Timestamps are now handled by functions that can choose between the
various timestamp forms. They actual choice is still hardcoded but
now there is a framework to easily change this.

Change-Id: I6a2f63037aae7f31e6ad320cd831595aa44aa00f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: log critical runtime filter errors 12/185412/9
Michal Bloch [Mon, 20 Aug 2018 13:13:02 +0000 (15:13 +0200)]
libdlog: log critical runtime filter errors

Change-Id: I4fede410764231bc2507348816c0ba3dbaa01c55
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: runtime filtering tests 60/186260/11
Maciej Slodczyk [Wed, 8 Aug 2018 10:26:02 +0000 (12:26 +0200)]
libdlog: runtime filtering tests

Change-Id: Ice1f9f0fe912786b3a830265a0ccf22f601cf42a
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoAdd dlogfilterctl: controls dynamic filters 17/186017/8
Michal Bloch [Mon, 6 Aug 2018 12:12:53 +0000 (14:12 +0200)]
Add dlogfilterctl: controls dynamic filters

Change-Id: If351b07c112bc3c53e10836f49af16127b29f24a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolimiter: add a way to get applicable rules 90/186290/7
Michal Bloch [Mon, 20 Aug 2018 13:10:42 +0000 (15:10 +0200)]
limiter: add a way to get applicable rules

Returns all applicable rules, including the shadowed ones so as to know
which rules would be in effect if the currently applicable one was removed.

Change-Id: I32c6bac5cd2ae4506e2c0942989fb19d608a2cb9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: runtime filtering 43/184643/14
Michal Bloch [Mon, 23 Jul 2018 16:35:43 +0000 (18:35 +0200)]
libdlog: runtime filtering

Change-Id: I5d82d5db6022e6d1617ad3414d817376c4429450
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolidbdlog limiter: allow updating the ruleset 39/186139/4
Michal Bloch [Tue, 7 Aug 2018 11:42:45 +0000 (13:42 +0200)]
lidbdlog limiter: allow updating the ruleset

Do not cleanup the ruleset after turning it into a hashmap to allow reuse.

Change-Id: Id45171ba8c60f4f4e39789309276a06208deaef9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: cleanup backend reading 44/185944/2
Michal Bloch [Wed, 1 Aug 2018 10:37:42 +0000 (12:37 +0200)]
util: cleanup backend reading

Change-Id: I99b7b0d050a5ed66fcc6649f8287692c7929bcdc
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: disallow mixing KMSG and other buffers 53/185653/4
Michal Bloch [Wed, 1 Aug 2018 09:38:18 +0000 (11:38 +0200)]
util: disallow mixing KMSG and other buffers

KMSG does not have the REALTIME_SENT timestamp available.
Meanwhile under the Android Logger backend the only timestamp available
is REALTIME_SENT. This makes it impossible to correctly sort logs and
complicates the design.

Change-Id: Ieedce46b2afe2428217c0ce895ba68c2fc77516f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoshared: syslog logging accepts printf-like params 43/184743/7
Michal Bloch [Fri, 20 Jul 2018 18:30:14 +0000 (20:30 +0200)]
shared: syslog logging accepts printf-like params

Fixes missing path name in one of the error logs and is convenient.

Change-Id: Ic6aaa86b92f673402aa2bc5095ee5984b9998745
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoshared: add a bunch of sorting helper functions 46/185946/2
Michal Bloch [Fri, 3 Aug 2018 09:46:38 +0000 (11:46 +0200)]
shared: add a bunch of sorting helper functions

 * sorting order -> clock type mapping
 * format -> sorting order mapping
 * config -> sorting order getter

Change-Id: I7af5029f7ed9a4ba74bb34f09cc210f625109dd4
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog limiter: safer pointer handling 40/184840/4
Michal Bloch [Wed, 1 Aug 2018 17:34:12 +0000 (19:34 +0200)]
libdlog limiter: safer pointer handling

The destructor functions now nullify the passed pointer.
This reduces some duplication but more importantly makes
sure there can be no double free.

Improve some precondition checks (asserts).

Change-Id: I21a443aebf6787c1903e971bc5fa5ad706a29612
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: isolate limiter creation 95/185795/3
Michal Bloch [Wed, 1 Aug 2018 17:17:50 +0000 (19:17 +0200)]
libdlog: isolate limiter creation

Limiter no longer checks whether it is enabled on construction,
it is now the caller's responsibility. This allows to construct
limiter with a limited config (for example containing just the
ruleset) and possibly to add extra rules between deciding to use
the limiter and actually creating it (so that the extras needn't
be loaded if opting out of the feature).

Change-Id: I8e6a4ad06c782f17e47cd5e90a73a150cf327eb3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: move limiter functions to loglimiter.c 42/184742/7
Michal Bloch [Wed, 1 Aug 2018 16:55:58 +0000 (18:55 +0200)]
libdlog: move limiter functions to loglimiter.c

Change-Id: I6ce8da53239257e1491b4cc184352f2bc596c0e2
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog limiter: fix duplicate rule handling 31/184831/4
Michal Bloch [Mon, 23 Jul 2018 11:07:25 +0000 (13:07 +0200)]
libdlog limiter: fix duplicate rule handling

A duplicate rule now updates the existing one instead of making a new one.

Change-Id: I96c3f6188495eb8a1eaffd0ac97b6061893a8e77
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolimiter: simplify code 55/186155/3
Michal Bloch [Tue, 7 Aug 2018 13:36:10 +0000 (15:36 +0200)]
limiter: simplify code

Change-Id: I28644362b8e749aa0df94236d6b98f3ef8658652
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodaemon: add sorting by selected timestamp 58/183558/9
Maciej Slodczyk [Fri, 6 Jul 2018 12:10:29 +0000 (14:10 +0200)]
daemon: add sorting by selected timestamp

In-daemon sorting feature allowed only to sort entries by
their default send timestamp. This patch adds a config entry
that allows to change that behavior and select a timestamp
to sort by from the list of: send monotonic, send realtime,
receive monotonic and receive realtime.

Change-Id: I28e6f6d714a3793c05934e733e4656e54a482508
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agoFix dlog-to-Dlog and Dlogutil-to-dlogutil on documentation
Hyotaek Shim [Tue, 7 Aug 2018 07:56:28 +0000 (16:56 +0900)]
Fix dlog-to-Dlog and Dlogutil-to-dlogutil on documentation

Change-Id: I34c55cf7e5b9a6feacd3b9eee013ad2842dde372
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
6 years agosvace fix 82/184982/1 accepted/tizen/unified/20180802.090201 submit/tizen/20180730.022401
sanghyeok.oh [Wed, 25 Jul 2018 02:55:40 +0000 (11:55 +0900)]
svace fix

Change-Id: I61bb4355468d3bb177b0bb35b80a069cf3e6a2b9
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
6 years agolibdlog: Change prio/tag params order for consistency with other functions 87/184687/1
Karol Lewandowski [Fri, 20 Jul 2018 06:36:10 +0000 (08:36 +0200)]
libdlog: Change prio/tag params order for consistency with other functions

Change-Id: I51cfc0e7b2679a4f551aefb64cbb04665fd14dc4

6 years agoutil: "generic" functions are actually pipe only 68/177268/3 accepted/tizen/unified/20180713.160204 submit/tizen/20180712.015849
Michal Bloch [Thu, 26 Apr 2018 11:50:46 +0000 (13:50 +0200)]
util: "generic" functions are actually pipe only

With the removal of binary files, the "generic" functions have
now become pipe-only. Reflect this in their names and location.

Change-Id: I0980d55a1bb573fc447567eaebe2dad48bf7ccfc
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoadd monotonic send timestamp when using android backend 36/169836/24
Maciej Slodczyk [Fri, 9 Feb 2018 13:09:28 +0000 (14:09 +0100)]
add monotonic send timestamp when using android backend

feature is experimental and can be enabled/disabled with
autoconf's configure script command line option

Change-Id: I99b35d704789df343cfd051f7984c36d8b602709
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agoadd realtime send timestamp when using pipe backend 35/169835/22
Maciej Slodczyk [Fri, 9 Feb 2018 13:06:41 +0000 (14:06 +0100)]
add realtime send timestamp when using pipe backend

Since kmsg has only monotonic send timestamp and syslog only realtime,
pipe backend should support both of them to be able to compare send timestamps
with both kmsg and syslog.

Change-Id: Ica48365ae4f287257168ce4d3737abb255fcd73b
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agosort out send/receive timestamp names in structures 34/169834/22
Maciej Slodczyk [Fri, 9 Feb 2018 13:04:14 +0000 (14:04 +0100)]
sort out send/receive timestamp names in structures

Split the 'time sent' time stamp into two fields (one for each clock
type), allowing each log to potentially keep both for flexibility.

Change-Id: I17df2878acf3f784ead839607d7d6db717b84749
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agoadd information when an entry is printed out of order 53/183453/7
Maciej Slodczyk [Thu, 5 Jul 2018 11:50:58 +0000 (13:50 +0200)]
add information when an entry is printed out of order

Sometimes an entry is delivered to dlog with a delay longer
than sorting window and needs to be printed out of order.
Add information when it happens to minimize the risk of
confusion

Change-Id: I1b0913ad4755899b9000e2707193f07c3cdc9931
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: test sorting by send timestamp 26/183226/4
Maciej Slodczyk [Tue, 3 Jul 2018 11:06:45 +0000 (13:06 +0200)]
testsuite: test sorting by send timestamp

Sorting is now done by send timestamp. This is because
logs received from Android Logger devices don't contain
a recv timestamp which prevents dlogutil from actually
sorting them at all (it adds the recv timestamp on its
own, which is useless for both sorting and printing)

Change-Id: I7f0a060e718918a5269394ffa1bb221a63c7493a
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agoutil: implement a better sorting heuristic 90/149890/15
Michal Bloch [Wed, 25 Apr 2018 12:47:59 +0000 (14:47 +0200)]
util: implement a better sorting heuristic

Peek at each buffer's entry and add the oldest one to the sorting container.
Notably, this is fairly similar to how the original dlogutil worked.

Change-Id: I6f3bb33f38f37828a2153d44f801e71280541bf4
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoutil: add peeking at a buffered log 19/177119/5
Michal Bloch [Wed, 25 Apr 2018 12:23:47 +0000 (14:23 +0200)]
util: add peeking at a buffered log

Not yet used, but needed for the implementation of the sorting heuristic.

Change-Id: I451e9f138a9862799defbf536553411ba22ac21b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoutil: read all ready log sources each iteration 78/158878/21
Michal Bloch [Mon, 16 Apr 2018 13:02:50 +0000 (15:02 +0200)]
util: read all ready log sources each iteration

This is necessary to be able to implement the "pick oldest" heuristic.

It should also result in a slight increase in sorting quality even now,
but this is mostly an afterthought.

Change-Id: Ic0e03bca96744c56cf19e6cc58954f83f6d3ac9c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoutil: fix duplicated logs with backup buffers 70/183470/1 accepted/tizen/unified/20180706.062151 submit/tizen/20180705.230400
Michal Bloch [Thu, 5 Jul 2018 17:01:32 +0000 (19:01 +0200)]
util: fix duplicated logs with backup buffers

If a buffer's primary device is unavailable, another can serve as
a backup. This feature has existed for a long time in libdlog, yet
dlogutil did not know about it. Thus, printing from a buffer would
fail if it used a backup device.

Recently this has been changed so that dlogutil prints logs from the
device that actually handles the buffer. This encapsulates the backup
feature and allows users to retrieve their logs without requiring any
knowledge of the backup mechanism, but fails when printing multiple
buffers that are being handled by the same device, resulting in log
duplication.

This patch fixes that failure mode by preventing devices from being
opened multiple times.

Change-Id: Iad43200da8f544a1e920182d7ec814fb917c402f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoutil: make log_len Android Logger backend specific 89/175089/5
Michal Bloch [Fri, 6 Apr 2018 13:55:48 +0000 (15:55 +0200)]
util: make log_len Android Logger backend specific

Under the pipe backend, it is the daemon who decides when to stop
sending more logs when dumping so util does not need to keep track.

Change-Id: I53aea552e8fd4bda2857dc63cef40d9f91f1b4d7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agokmsg parser uses supplied priority and facility 85/177385/4 accepted/tizen/unified/20180704.153959 submit/tizen/20180704.010647
Michal Bloch [Fri, 27 Apr 2018 12:55:29 +0000 (14:55 +0200)]
kmsg parser uses supplied priority and facility

Previously it was ignored and set to ERROR/"DEVKMSG".

Change-Id: Icaf481b741459d2053b4b2f73c51c2b2e465dd38
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoshared: split up queued_entry into separate files 84/177384/4
Michal Bloch [Fri, 27 Apr 2018 12:54:37 +0000 (14:54 +0200)]
shared: split up queued_entry into separate files

queued_entry used to contain a bunch of things that happened to use
one another but weren't otherwise related. Split them up to make the
files more specific and easier to navigate.

Change-Id: Ie709e7d9261bbd484d6e13fcceaa9fce495782cc
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoFix test contamination when missing apps AL device 18/183018/2
Michal Bloch [Fri, 29 Jun 2018 17:09:58 +0000 (19:09 +0200)]
Fix test contamination when missing apps AL device

Some devices have neither `/dev/log_apps` nor `/dev/log_events`
and so any `apps` logs end up in `main`. For testing we disable
other users from writing to `main` but not to `apps`, so the
redirection contaminates the testing environment.

Change-Id: I915e295c188319e4fe3a0c9403df17b163f15425
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: stop at first found buffer file even when unable to open it 45/182845/2
Maciej Slodczyk [Thu, 28 Jun 2018 09:15:34 +0000 (11:15 +0200)]
logger: stop at first found buffer file even when unable to open it

When trying to open a buffer device file from a list of possible
paths, make the process stop at first file that exists even if it
has no permissions to open that file. This will prevent from
opening a wrong or fallback buffer.

Change-Id: Iad6cc0154fc173066456395bfb1863ff4ccf27d9
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: add information when logger daemon dies during tests 91/182391/9
Maciej Slodczyk [Fri, 22 Jun 2018 12:42:16 +0000 (14:42 +0200)]
testsuite: add information when logger daemon dies during tests

Change-Id: If8abee87351465d68d37918b8562692ed31b958c
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agologger: add 'main' buffer as a fallback for other buffers 89/182389/10
Maciej Slodczyk [Thu, 21 Jun 2018 15:16:06 +0000 (17:16 +0200)]
logger: add 'main' buffer as a fallback for other buffers

Change-Id: Ic5399c4226cf008d0bd57108ba960e99509a3bb6
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agologger: eliminate possible bug when copying strings 88/182388/10
Maciej Slodczyk [Thu, 21 Jun 2018 15:08:29 +0000 (17:08 +0200)]
logger: eliminate possible bug when copying strings

The strncpy() call may result in unterminated
string bug if a source does not contain a string
termination byte in specified length.

Change-Id: I17a0a474d1e7589ba3ae4172e28c102f56bdc37b
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agologger: eliminate race condition in opening a buffer file 87/182387/10
Maciej Slodczyk [Thu, 21 Jun 2018 12:45:53 +0000 (14:45 +0200)]
logger: eliminate race condition in opening a buffer file

With a patch that allows specifying multiple buffer paths
in config file a race condition was introduced: the
existence of a buffer file was checked with access() in a loop,
then the one that was found was opened with open(). Now, the
access() call is eliminated, the file is opened immediately.

Change-Id: Ieda1219eef8457e0c1f21ad1d4a2112a933f39a4
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: add README file 02/182002/5
Maciej Slodczyk [Tue, 19 Jun 2018 13:55:39 +0000 (15:55 +0200)]
testsuite: add README file

Change-Id: I4f1a0bab9b1ca6bc8cbe455ec751096271a7b87b

6 years agologger: allow specifying multiple buffer paths in config file 53/181553/9
Maciej Slodczyk [Thu, 14 Jun 2018 15:32:31 +0000 (17:32 +0200)]
logger: allow specifying multiple buffer paths in config file

Change-Id: I53b87c26265b4c7774116c4f242abbc8149014b7
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agolcov: added excluding line 09/181009/4
sanghyeok.oh [Thu, 7 Jun 2018 07:59:12 +0000 (16:59 +0900)]
lcov: added excluding line

Change-Id: I41e6d5102c740d60ae3bb3aece09a769afe68bac
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
6 years agoutil: improve formats (-v) documentation 48/181548/2
Michal Bloch [Thu, 14 Jun 2018 14:45:28 +0000 (16:45 +0200)]
util: improve formats (-v) documentation

Add a description of how each format looks
and what some of the values mean.

Change-Id: I2c90c26ceb12af04652ce75bd4a0ee57e819aa05
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agotestsuite: supress stderr messages from subcommands during tests 51/181551/2 accepted/tizen/unified/20180619.142039 submit/tizen/20180619.052936
Maciej Slodczyk [Wed, 13 Jun 2018 15:45:48 +0000 (17:45 +0200)]
testsuite: supress stderr messages from subcommands during tests

Change-Id: I92285b5c8f4433db5157acccf4b245ac99d46592

6 years agopackaging: logger: Ensure logger device node permissions are applied before dlog_logg... 57/180457/4
Karol Lewandowski [Tue, 29 May 2018 15:14:10 +0000 (17:14 +0200)]
packaging: logger: Ensure logger device node permissions are applied before dlog_logger is started

This is workaround for dlog_logger being started before udev applies
its rules (which includes device node permissions, which dlog tries
to access).

Change-Id: Idd942e83bad03bd1eeefc8e5aa4a790f3d9c67dd

6 years agopackaging: tests: Do not try reboot machine to ensure proper dlog config 48/181648/2
Karol Lewandowski [Fri, 15 Jun 2018 08:44:23 +0000 (10:44 +0200)]
packaging: tests: Do not try reboot machine to ensure proper dlog config

Installing dlog-tests package intentionally breaks
dlog setup for normal use case, but system should
not be rebooted without user consent.  Rebooting
in %post might potentially make RPM db inconsistent
and impact other pending rpm actions.

Change-Id: I95e7eb0fcf6f12ff20c0bfaa6699e476793e4a4b

6 years agoMerge "Revert "logger: detect proper apps/events buffer path"" into tizen
Karol Lewandowski [Thu, 14 Jun 2018 12:25:45 +0000 (12:25 +0000)]
Merge "Revert "logger: detect proper apps/events buffer path"" into tizen

6 years agoFix sorting breaking tail dump mode 67/181367/3
Michal Bloch [Tue, 12 Jun 2018 12:06:21 +0000 (14:06 +0200)]
Fix sorting breaking tail dump mode

Change-Id: Ic15181104fc1f0c3bed8d487f9a0c18c33505805
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoRevert "logger: detect proper apps/events buffer path" 79/181379/1
Michal Bloch [Tue, 12 Jun 2018 15:07:38 +0000 (17:07 +0200)]
Revert "logger: detect proper apps/events buffer path"

This reverts commit f4fe42b5dc8dcff4572353675c1bc52a62d7d939.

The post-install script works correctly as long as the package
is installed on the target directly. However, it won't work if
it arrives on the target by being included in an image, due to
the post-install script having been ran on a different system,
the one where the image had been built and not the target one.

There isn't a strict regression because the end result is that
the image sometimes contains the other path (which means there
are still some devices that will work and some that won't), so
there might still be value to keeping the change as a reminder
of the underlying problem of Android log device availablility.

Change-Id: Id71b5a66d3115fdac876ad06c51aed607a31b452
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: make a printing function const 78/177378/3
Michal Bloch [Fri, 27 Apr 2018 10:41:46 +0000 (12:41 +0200)]
logger: make a printing function const

Log entries should never be modified by being printed
so this helps prevent possible mistakes in the future.

Change-Id: Ib03209db7fbcc382a73c24ababe172da5bdcdbbf
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: detect proper apps/events buffer path 57/181157/4
Maciej Slodczyk [Fri, 8 Jun 2018 15:02:21 +0000 (17:02 +0200)]
logger: detect proper apps/events buffer path

Depending on a kernel version apps/events device file
path differ - it's either /dev/log_apps in older kernel
implementations of android logger backend, or
/dev/log_events in newer ones. The path to the device
file is set by a config file. With this patch, the right
path is detected when dlogbackend-logger is installed
and proper config files are placed in /opt/etc/dlog.conf.d/

Change-Id: Ic08bc13ff2ae7a86099ea3a0e2e5586aeb21babd
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: simplify syntax 43/180243/8
Maciej Slodczyk [Fri, 25 May 2018 21:03:10 +0000 (23:03 +0200)]
testsuite: simplify syntax

Change-Id: Id6883b2156a99859905e2ae61ffbfe462cf65ff9

6 years agotestsuite: add pid/tid filter tests 25/180825/2
Maciej Slodczyk [Mon, 4 Jun 2018 13:29:26 +0000 (15:29 +0200)]
testsuite: add pid/tid filter tests

Change-Id: I0e92b5c9b52e059cc4ebfa68986d1aa1bc16d8ac
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: add logger backend tests 89/180089/7
Maciej Slodczyk [Wed, 23 May 2018 12:25:29 +0000 (14:25 +0200)]
testsuite: add logger backend tests

Change-Id: I722182f1d9c3a1c49df77e62df13c8517a9b38bd
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: add util print formats tests 88/180088/7
Maciej Slodczyk [Fri, 25 May 2018 20:25:09 +0000 (22:25 +0200)]
testsuite: add util print formats tests

Change-Id: Ia70b9a7be31e5eeecfc9506a24587993cdad2c43
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: add parameter parsing correctness tests 92/180092/6
Maciej Slodczyk [Fri, 25 May 2018 20:20:56 +0000 (22:20 +0200)]
testsuite: add parameter parsing correctness tests

Change-Id: Ia6c8de2bf159301bf4fb66cb9e44ef2d956574ec
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: add more descriptive output 87/180087/5
Maciej Slodczyk [Fri, 25 May 2018 19:41:29 +0000 (21:41 +0200)]
testsuite: add more descriptive output

Change-Id: I5d9555fa2f476f4f62da6cf9e5ee93ad17abaa7f
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: add sorting test scripts 84/180084/5
Maciej Slodczyk [Fri, 25 May 2018 18:24:55 +0000 (20:24 +0200)]
testsuite: add sorting test scripts

Change-Id: Ia91e649af6c0aa191b9034445813ccca6fd2fd6e
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agotestsuite: introduce reliable cleanup 42/180242/4
Maciej Slodczyk [Fri, 25 May 2018 18:01:00 +0000 (20:01 +0200)]
testsuite: introduce reliable cleanup

Handles both usual and abnormal exits.

Change-Id: Ic28753e00d23beb5bfa4ddbbaf267a6bb12c754e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agotestsuite: now has its own folder 65/180365/5
Michal Bloch [Mon, 28 May 2018 11:39:20 +0000 (13:39 +0200)]
testsuite: now has its own folder

Running inside the /tmp folder is a potential security issue.

Change-Id: I540deabb722a828a522adc52982056d2690524d9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agopipe: remove padding for odd-length messages 75/176675/2 accepted/tizen/unified/20180424.082531 submit/tizen/20180423.122745
Michal Bloch [Fri, 20 Apr 2018 14:45:42 +0000 (16:45 +0200)]
pipe: remove padding for odd-length messages

Since 154c5eaaf1ecf6224de0bcafc872c4952ffdae9b, the padding
is no longer needed as the daemon handles odd lengths correctly.

Change-Id: I722efc2e5e73f26f1896510da857a42bbfebed9c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoshared: fix wrong payload size when parsing android logger message 65/176765/2
Maciej Slodczyk [Mon, 23 Apr 2018 09:09:28 +0000 (11:09 +0200)]
shared: fix wrong payload size when parsing android logger message

There's priority in the first byte of payload which was stripped
off but the payload size was not correctly adjusted to take this
fact into account. Now the size is calculated correctly.

Change-Id: I66227d65ca7198190419df92da8a59b9099db091

6 years agoMerge "shared: hot fix for wrong computing of message length" into tizen accepted/tizen/unified/20180423.062818 submit/tizen/20180420.152033
Karol Lewandowski [Fri, 20 Apr 2018 15:18:46 +0000 (15:18 +0000)]
Merge "shared: hot fix for wrong computing of message length" into tizen

6 years agoshared: hot fix for wrong computing of message length 73/176673/1
Adrian Szyndela [Fri, 20 Apr 2018 14:22:02 +0000 (16:22 +0200)]
shared: hot fix for wrong computing of message length

log_format_log_line() in its final stage (starting from line 804),
adds prefix and suffix for each line. To prepare for it,
it computes lineLen by iterating to next end-of-line. Then it
simply substracts two pointers.

The iterating condition checks only if the iteration goes beyond
the message and characters are not end-of-line. However,
sometimes the total length of the message in log_entry is larger than
actual message (TODO! Check why! It is not OK!). In such case
computed line length may be larger than actual string length.
Then, strings are concatenated (up to NUL bytes), but the destination
buffer pointer is moved by too large value, effectively skipping
trailing NUL.

This patch corrects the computation of line length, taking into
account that there may actually be (potentially rogue) NUL byte
hidden somewhere inside the message.

Change-Id: Iadd04045d28c67e947e6f0066f592196f53d9781

6 years agoMerge "logger: a bunch of fixes for memory leaks" into tizen
Michal Bloch [Fri, 20 Apr 2018 11:19:44 +0000 (11:19 +0000)]
Merge "logger: a bunch of fixes for memory leaks" into tizen

6 years agologger: a bunch of fixes for memory leaks 50/176650/1
Adrian Szyndela [Fri, 20 Apr 2018 10:09:54 +0000 (12:09 +0200)]
logger: a bunch of fixes for memory leaks

Change-Id: Id519bb6489a9ba52e3a8b32cdce2c144bab08217

6 years agoMerge "pipe: Do not wait for pipe_fd indefinitely" into tizen accepted/tizen/unified/20180420.081904 submit/tizen/20180419.135953
Karol Lewandowski [Thu, 19 Apr 2018 13:55:41 +0000 (13:55 +0000)]
Merge "pipe: Do not wait for pipe_fd indefinitely" into tizen

6 years agopipe: Do not wait for pipe_fd indefinitely 73/176473/3
Karol Lewandowski [Thu, 19 Apr 2018 11:12:21 +0000 (13:12 +0200)]
pipe: Do not wait for pipe_fd indefinitely

In the case of dlog_logger crash dlog clients
will try to reconnect to server and receive pipe_fd
for logging again.  However, if dlog_logger is being
dumped (in Tizen - by crash-worker), clients will be
able to connect to the socket and request the new
pipe_fd, but recv() for fd will make client block
forever.

This commit works around this problem by introducing
finite timeout for which recv can wait.

Change-Id: Iddbbe668a084a2d0f4fcb2c34b80737d8c4c7eb6

6 years agoAdd .gitignore 73/175973/1 accepted/tizen/unified/20180416.213853 submit/tizen/20180416.044615
Hyotaek Shim [Mon, 16 Apr 2018 04:43:13 +0000 (13:43 +0900)]
Add .gitignore

Change-Id: Ibea939edeb45994de2c9b2eadfa1e4d3f2653f8b
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
6 years agoshared: Fix issue with pointer casting on 64bit system 08/175908/3
Wook Song [Fri, 13 Apr 2018 06:29:54 +0000 (15:29 +0900)]
shared: Fix issue with pointer casting on 64bit system

The type casting from the pointer of a signed int value to the pointer
of a signed long value (time_t, especially in this patch) could provide
unintended result in 64bit system. This patch fixes this issue related
to using the localtime/localtime_r function.

Change-Id: Ief46cc079a64e628c1219dc7638a494264583af5
Signed-off-by: Wook Song <wook16.song@samsung.com>
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
6 years agoFix build error with HAVE_LOCALTIME_R 46/175646/1 accepted/tizen/unified/20180412.073846 submit/tizen/20180411.085824
Hyotaek Shim [Wed, 11 Apr 2018 08:56:02 +0000 (17:56 +0900)]
Fix build error with HAVE_LOCALTIME_R

Change-Id: Ia276b3728b7a42d5813fac2ba27d0315b2ed2fe8
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
6 years agoRemove unnecessary log_entry struct 85/174685/2 submit/tizen/20180411.015803
Maciej Slodczyk [Tue, 3 Apr 2018 11:11:17 +0000 (13:11 +0200)]
Remove unnecessary log_entry struct

After removal of unnecessary entry parsing between
two formats it is pointless to keep the log_entry
struct.

Change-Id: I5eb84554a5be299d6aeb2f47d7ae02f7f54bd8c1
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
6 years agoStorage format keeps cached priority 93/173993/13
Maciej Slodczyk [Tue, 27 Mar 2018 10:11:23 +0000 (12:11 +0200)]
Storage format keeps cached priority

Change-Id: I2b60fe7909b60883133fd9ff7bb39879e8548253

6 years agodlog_logger daemon: handle epoll dynamically 90/174690/7 accepted/tizen/unified/20180411.065555 submit/tizen/20180410.115257
Michal Bloch [Wed, 4 Apr 2018 13:58:29 +0000 (15:58 +0200)]
dlog_logger daemon: handle epoll dynamically

The daemon used to have a static array for 1024 FDs (ie. the default
file descriptor limit). This was both wasteful in the usual case, as
usually this value is not reached, and incorrect otherwise, because
this limit can be increased, causing any extra FDs to starve.

Change-Id: Ifc61a2cecbfb1b78fcf00abe9655f02147f8316f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologger: fix leaking log_storage_readers 37/175237/2
Adrian Szyndela [Mon, 9 Apr 2018 11:38:06 +0000 (13:38 +0200)]
logger: fix leaking log_storage_readers

log_storage_reader was not freed at all...

Credit for finding to MichaƂ Bloch <m.bloch@samsung.com>.

Change-Id: I9af873a563f47919cc61b21ac226d7e8ceccaac5

6 years agologger: fix for use-after-free in log storage 23/175223/1 accepted/tizen/unified/20180410.063705 submit/tizen/20180409.103811
Adrian Szyndela [Mon, 9 Apr 2018 09:55:14 +0000 (11:55 +0200)]
logger: fix for use-after-free in log storage

A report from ASAN build has shown a bug while freeing a storage.

When a dumping reader was created with no available logs it
was disconnected from storage, but put into waiting_readers.

This commit changes log_storage_new_reader() in a way that
a reader is added to waiting_readers only if it is connected
to the storage.

Change-Id: Id6033fe73e86674384feb2fafb9b3814f0f0b73e

6 years agoutil: fix dump mode not ending 79/175079/2
Michal Bloch [Fri, 6 Apr 2018 13:57:42 +0000 (15:57 +0200)]
util: fix dump mode not ending

An important bit of code sat inside a snippet only otherwise useful with
binary files and accidentally got culled alongside them during their
recent removal (cf. 31655fb8b716991ecfdc8e2422a0bb3e05305b1b)

Change-Id: I69e8b329edc62248df2a23a114c099720bc15d09
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoutil: remove dynamic sort vector growth 71/174871/2 accepted/tizen/unified/20180405.064256 submit/tizen/20180404.150538
Michal Bloch [Wed, 4 Apr 2018 13:04:32 +0000 (15:04 +0200)]
util: remove dynamic sort vector growth

This reverts f9b568e5484d85d373033b2bf6857ef39cfc5c39.

Dynamic growth was originally implemented to help improve sorting quality.
However, it removes the bound on memory usage and was discovered to cause
starvation in case of a constant flow of logs. The need for very large
vectors has also recently been reduced with the implementation of sorting
in the daemon (cf. commit e937e788bfcf4d4e791dac47099f998c778dd4fc,
"logger: inserting logs in ordered way to the buffers").

Change-Id: I6d0c89531ea7aca28b9062a4054b9975e25f0d36
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoutil: fix a crash on -u 0 and -u 1 70/174870/2
Michal Bloch [Wed, 4 Apr 2018 12:52:31 +0000 (14:52 +0200)]
util: fix a crash on -u 0 and -u 1

The sorting vector was not allocated in those cases
since it was not actually needed, but an assumption
had erroneously been introduced that it always exists.

Change-Id: I231be3cc80975792a5b5cbf6a668cd8308e43a31
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoRemove unnecessary entry parsing 64/173864/10
Maciej Slodczyk [Mon, 26 Mar 2018 12:07:18 +0000 (14:07 +0200)]
Remove unnecessary entry parsing

Change-Id: Ia79f67e5f42702ef70ed64b2e8b76f963d63b99b

6 years agoremove unused callback function 55/174155/4
Maciej Slodczyk [Wed, 28 Mar 2018 13:47:13 +0000 (15:47 +0200)]
remove unused callback function

struct log_file has a callback function pointer, set by
logfile_open() and used when handling binary files in
daemon. Since binary files support is removed, it is no
longer needed.

Change-Id: Idee02b1f2c3e9af2cad26c68f10ae0fb903f9730

6 years agoutil: remove binary files support, plaintext only 18/173618/7
Maciej Slodczyk [Thu, 22 Mar 2018 15:18:38 +0000 (16:18 +0100)]
util: remove binary files support, plaintext only

Binary files support is no longer needed as log entries
are now sorted by daemon.

Change-Id: Ia24712bb23b45606e477c43fa036e2904a2f45ee

6 years agodaemon: don't create binary files, plaintext only 17/173617/6
Maciej Slodczyk [Thu, 22 Mar 2018 15:16:08 +0000 (16:16 +0100)]
daemon: don't create binary files, plaintext only

Binary files support is no longer needed as log entries
are now sorted by daemon.

Change-Id: I84dee5b25af358ad9de73a6209e7969b7d892b98

6 years agoStorage format keeps cached tag length 35/173335/9
Michal Bloch [Tue, 20 Mar 2018 11:08:01 +0000 (12:08 +0100)]
Storage format keeps cached tag length

It has to be done at some point anyway, so do it once and be
done with it forever (previously each util reparsed the message
on its own). It's also progress towards unifying the two "entry"
structures.

Change-Id: I17f7ef2675070c228c764743a53e0a64892dd2cb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoKMSG parser: refactor 54/173754/5
Michal Bloch [Fri, 23 Mar 2018 13:11:57 +0000 (14:11 +0100)]
KMSG parser: refactor

Remove some variables that are no longer needed now that extended-kmsg
has been removed. Add commentary.

Change-Id: Ica194fca05694216bbd3b3d6d6f733122feafbfa
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoRemove inplace KMSG parsing 33/173333/6
Michal Bloch [Tue, 20 Mar 2018 13:56:38 +0000 (14:56 +0100)]
Remove inplace KMSG parsing

KMSG messages were parsed in-place, which made the process fragile
and prone to break in case the log format was changed.

Change-Id: Ie3517e172806bd54cdb3164578065cf9ab848426
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agologconfig: Remove dead code 77/173977/3
Karol Lewandowski [Tue, 27 Mar 2018 08:49:19 +0000 (10:49 +0200)]
logconfig: Remove dead code

Remove functions that were created for dlogctrl
utility, removed from codebase in commit 06d8039.

Change-Id: I2ff44899e60abe58c5b7bc33d9eee90c0a1a1464