summaryrefslogtreecommitdiffstats
path: root/logd
Commit message (Collapse)AuthorAgeFilesLines
* logd: pruning time horizonMark Salyzyn2015-11-041-1/+4
| | | | | | | | Estimate a time horizon of ten fold for worst UID pruning Bug: 25453210 Bug: 24782000 Change-Id: I7118deb6d42531c68ed2ac2a59c57b0580b942cc
* Merge "logd: worst uid record watermark part five" into mnc-dr-devMark Salyzyn2015-09-141-4/+56
|\
| * logd: worst uid record watermark part fiveMark Salyzyn2015-09-101-4/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry pick from commit 5bb2972dce918b60f1ed9ddc6fe0636e97679187) A regression that resulted in increased memory consumption for some logging patterns because we rarely did merge or leading checks, and age-out checking. On the last prune cycle, we reset for a full scan. Add some comments describing the pruning processes. Bug: 23327476 Bug: 23681639 Bug: 23685592 Change-Id: I22b0f339c9269b006831fda9cefe295a263ebb92
* | logd: klogd and MediatekMark Salyzyn2015-09-112-16/+50
|/ | | | | | | | | | | | | | | | | | | | | | | (cherry pick from commit 46d159d4626ca5d5667b739792840c3178a1457b) - sniff for PID in kernel log messages if available - properly deal with klogd watermark in face of modified output - deal more stringently with priority tag, must have [ following - suppress process-name stutter in tag that can happen - do not use : to demark tag if within [ ] Mediatek-special change that adds <printk_state>(<cpu>)[<pid>:<comm>] as a prefix to the printk messages. Along the lines of (simplified for entertainment purposes, YMMV): char tbuf[50]; /* printk prefix */ int this_cpu = smp_processor_id(); char state = __raw_get_cpu_var(printk_state); unsigned tlen = snprintf(tbuf, sizeof(tbuf), "%c(%x)[%d:%s]", state, this_cpu, current->pid, current->comm); Bug: 23517551 Change-Id: I568e25c5aa6d8474835454a0e83b19c2921b7985
* logd: worst uid record watermark part fourMark Salyzyn2015-09-042-9/+11
| | | | | | | | | | | | | | | | | | | (cherry pick from commit 831aa297307a038705bc771281ffd53266484b4a) With part deux we caused an apparent regression by not checking for stale recorded iterators. This checking was on-purpose bypassesed when leading prune entries were to be deleted without touching the statistics engine due to an in-place merge. Part deux had us leaving iterators we were not focussed on untouched which in turn because they were left behind, had a much higher likelihood of being deleted without touching the statistics engine. Perform the check every delete. Bug: 23789348 Bug: 23490267 Change-Id: Idc6cc23d1f9e3b6cd9a083139a0de59479fbfe08
* Merge "logd: worst uid record watermark part three" into mnc-dr-devMark Salyzyn2015-09-011-12/+11
|\
| * logd: worst uid record watermark part threeMark Salyzyn2015-08-311-12/+11
| | | | | | | | | | | | | | | | | | | | (cherry pick from commit ccfe8446a19c1c0c9e55133fde84dedb2b9f5d4f) Regression that cause records to be preserved for more than a day. Bug: 23681639 Bug: 23685592 Change-Id: I5e4393c8e3ed935790994c77ec51dc6512a6daa6
* | Merge "logd: worst uid record watermark part deux" into mnc-dr-devMark Salyzyn2015-09-011-1/+5
|\|
| * logd: worst uid record watermark part deuxMark Salyzyn2015-08-311-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry pick from commit 49afe0d00fdc163e5b8a1ab2f859c4688613d5b8) Only record watermark if not known, or represents the worst UID currently under focus. This has resulted in a halving of the average prune time in the face of heavy spam because we get less processing spikes. Bug: 23327476 Bug: 23681639 Bug: 23685592 Change-Id: I19f297042b9fc2c98d902695c1c36df1bf5cd6f6
* | healthd: logd: add timestamp to kernel logged battery messagesMark Salyzyn2015-08-271-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry pick from commit acb1ddf56c98a75a49b263f99ef07ce361dc4323) Aid monotonic to realtime logging synchronization correction in the Android ecosystem by providing a periodic notification. We now have the following messages in the kernel logs: - PM: suspend entry %Y-%m-%d %H:%M:%S.%09q UTC - PM: suspend exit %Y-%m-%d %H:%M:%S.%09q UTC - Suspended for %s.%03q seconds - healthd: battery l=100 ... %Y-%m-%d %H:%M:%S.%09q UTC Alter klogd to resynchronize on healthd messages as well. NB: Time using strftime format, %q is a reference to fractional second as introduced into log_time strptime method. Bug: 21868540 Change-Id: I854afc0a07dff9c7f26d2b2f68990e52bf90e300
* | logd: refine is_prioMark Salyzyn2015-08-271-9/+15
|/ | | | | | | | | | | | | (cherry pick from commit 618d0dec5037df0fad1ce5cc90da2b7fc2c88b0c) - Heuristics associated with translation of kernel messages to Android user space logs. - Limit is_prio to 4 characters, we got false positives on hex values like <register contents> with no alpha chars. - x11 and other register definitions are not valid tags, en0 is - fix some Android coding standard issues Change-Id: Idc3dcc53a2cb75ac38628c8ef7a5d5b53f12587a
* logd: worst uid record watermarkMark Salyzyn2015-08-202-1/+23
| | | | | | | | | | (cherry pick from commit c892ea3fa80dfd3d35c5a3b8bfdc73e7b85eaede) Hold on to last worst uid watermark and bypass a spike to O(n*n*x) (n=samples, x=number of spammers) wrt chatty trimming. Bug: 23327476 Change-Id: I9f21ce95e969b67e576417a760f75c4d86acf364
* logd: log buffer switch to std::listMark Salyzyn2015-08-201-2/+3
| | | | | | | | (cherry pick from commit 94a89c42fe9521f5ac2d382a172c082ca421d6c3) Bug: 23350706 Bug: 23327476 Change-Id: Ib0530b9dd5842c6d05c84d7a66f2531c97461067
* logd: white and black switch to std::listMark Salyzyn2015-08-202-19/+13
| | | | | | | (cherry pick from commit e0ed16c6db5c443ecb5f9f7daca95a111fd1f582) Bug: 23350706 Change-Id: I981d9fa63a0d87eb309485cca93cfc44fc0506cc
* logd: logtimes switch to std::listMark Salyzyn2015-08-202-4/+6
| | | | | | | (cherry pick from commit 98dca2d0b15f9a579efae8592dbb45059aad082e) Bug: 23350706 Change-Id: Icc60dd06119ea20a22610644ff880d5135363aba
* logd: prune 10% or 256 entries maxMark Salyzyn2015-08-201-11/+7
| | | | | | | | (cherry pick from commit b39ed0c9925356c74a6347630b04d875288d803b) Bug: 22351810 Bug: 23327476 Change-Id: I902ba6b431d8b7cee2d65ee2f76e9f7c4f30b152
* logd: sizes > 1M prune in smaller batchesMark Salyzyn2015-08-201-8/+15
| | | | | | | | | (cherry pick from commit 62ab0fd4efeed313adf2fdf84167d754620c0ad1) Switch to 1% batch sizes from 10% when individual buffer size > 1M Bug: 22351810 Change-Id: Ifee570a54643ceb0ba767e1787e937f70cc90b72
* logd: allow logd to write to /dev/cpuset filesJeff Vander Stoep2015-07-241-0/+4
| | | | | | | | | | | | Required by logd on devices with USE_CPUSETS defined. Make /dev/cpuset/background, /dev/cpuset/foreground and /dev/cpuset/task writeable by system gid. Add logd to system group for writing to cpuset files and to root group to avoid regressions. When dropping privs, also drop supplementary groups. Bug: 22699101 Change-Id: Icc01769b18b5e1f1649623da8325a8bfabc3a3f0
* logd: serialize accesses to stats helpersMark Salyzyn2015-06-254-4/+19
| | | | | | | | | | | | | (cherry pick from commit ed777e9eece54bf899f1a77a83f8b702970de686) Quick low-risk to resolve possible hash table corruption. Resolved an unlikely path memory leak. ToDo: replace lock with nested lock so no lock helpers are required. Bug: 22068332 Change-Id: I303ab06608502c7d61d42f111a9c43366f184d0c
* logd: missing klogd contentMark Salyzyn2015-06-153-42/+68
| | | | | | | | | | | | | | | | | | | | | | | (cherry pick from commit ee49c6a670a54e0636f81f39ddc93c87c9a4d766) - regression in log_strtok_r (part deux) In commit 'logd: fix kernel logline stutter' 2c3b300fd8307e8da13608197d0a89bc613de5fb we introduced log_strtok_r. as a replacement for strtok_r that dealt with a problem with some kernel log messages. Fix is to refine definition of is_timestamp to not match on patterns like [0], requiring a single period. Another fix is to refine definition of is_prio to properly escape non-digit content. - Missing content because SYSLOG_ACTION_SIZE_BUFFER with added logging is too short for full read of SYSLOG_ACTION_READ_ALL dropping initial content. Add a margin for additional 1024 bytes. - Absolute _first_ log entry has sequence number of 1, which is specifically dropped, start sequence count at 1 rather than 0. - Remove trailing space for efficiency. - If tag exists but no content, trick into kernel logging. Bug: 21851884 Change-Id: I0867a555a3bca09bbf18d18e75e41dffffe57a23
* logd: filter on __android_log_is_loggableMark Salyzyn2015-06-152-1/+23
| | | | | | | | | | | | (cherry pick from commit e59c469fa89d438d2d7150b7d8cd6b401900709b) - Default level when not specified is ANDROID_LOG_VERBOSE which is inert. Bug: 20416721 Bug: 19544788 Bug: 17760225 Change-Id: Icc098e53dc47ceaaeb24ec42eb6f61d6430ec2f6
* Merge "Lower the priority of the threads in logd/logcat." into mnc-devMark Salyzyn2015-06-091-0/+7
|\
| * Lower the priority of the threads in logd/logcat.Riley Andrews2015-06-091-0/+7
| | | | | | | | | | | | | | | | | | sched_batch implies only a penalty to latency in scheduling, but does not imply that the process will be given less cpu time. Increase the nice level to 10 to prioritize it below ui threads. Bug: 21696721 Change-Id: I075af059dc755402f7df9b0d7a66cca921ff04b2
* | logd: build breakageMark Salyzyn2015-06-081-1/+1
| | | | | | | | | | | | | | | | (cherry pick from 3e21de2915a44d9f6d6a9e8610a2fc5feb33d107) OPEN_BRACKET_SPACE comparison always false Change-Id: I1ff4288b4b79a49702727d3a8b8c8f179f500951
* | logd: fix kernel logline stutterMark Salyzyn2015-06-083-4/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | (cherry pick from commit 2c3b300fd8307e8da13608197d0a89bc613de5fb) - look for cases where one log line contains two without a newline. - rare condition, occurs when a printk does not have a terminating newline under certain race conditions. - the newline may be performed broken up as a second call - the timestamps can be reversed (showing the race effects). - driver(s) should really have the newline in their log messages. Change-Id: Ibfb56b32047da3d6513db059ca6edad0f0105168
* | logd: filters remove leading expire messages and rateMark Salyzyn2015-06-055-11/+39
|/ | | | | | | | | | | | | | | | | | | (cherry pick from commit 047cc0729fd837a03b99db901941c1421ef15f96) - Cleanup resulting from experience and feedback - When filtering inside logd, drop any leading expire messages, they are cluttering up leading edge of tombstones (which filter by pid) - Increase and introduce EXPIRE_RATELIMIT from 1 to 10 seconds - Increase EXPIRE_THRESHOLD from 4 to 10 count - Improve the expire messages from: logd : uid=1000(system) too chatty comm=com.google.android.phone, expire 2800 lines change tag to be more descriptive, and reduce accusatory tone to: chatty : uid=1000(system) com.google.android.phone expire 2800 lines - if the UID name forms a prefix for comm name, then drop UID name Change-Id: Ied7cc04c0ab3ae02167649a0b97378e44ef7b588
* logd: switch to unordered_map from BasicHashtableMark Salyzyn2015-06-043-63/+56
| | | | | | | | | | | | (charry pick from commit 511338dd575572d567c04d69eaea60627b6c3452) BasicHashtable is relatively untested, move over to a C++ template library that has more bake time. Bug: 20419786 Bug: 21590652 Bug: 20500228 Change-Id: I926aaecdc8345eca75c08fdd561b0473504c5d95
* init.rc: logd: Add logpersistd (nee logcatd)Mark Salyzyn2015-06-023-0/+49
| | | | | | | | | | | | | | | | | | | (cherry pick from commit 100658c303919d8f69c76f6f25eac376795712f0) - logpersistd is defined as a thread or process in the context of the logd domain. Here we define logpersistd as logcat -f in logd domain and call it logcatd to represent its service mechanics. - Use logcatd to manage content in /data/misc/logd/ directory. - Only turn on for persist.logd.logpersistd = logcatd. - Add logpersist.start, logpersist.stop and logpersist.cat debug class executables, thus only in the eng and userdebug builds. ToDo: Wish to add Developer Options menu to turn this feature on or off, complicated by the fact that user builds have no tools with access rights to /data/misc/logd. Bug: 19608716 Change-Id: I57ad757f121c473d04f9fabe9d4820a0eca06f31
* logd: test modernizationMark Salyzyn2015-06-011-47/+35
| | | | | | | (cherry pick from commit 62d6a2a921d5ee5cc455e6ae5e62d4ad2474fd25) Bug: 19603976 Change-Id: Ie920c128e7e6a436fea7a96c7d68bc39e13a2ad4
* logd: whitelist should not preserve expire messagesMark Salyzyn2015-06-011-1/+1
| | | | | | (cherry pick from commit c5bf3b830472bca677407833018f20b7643953fe) Change-Id: I56275c73191b96aa21e7b4049d401e1f44211f9b
* logd: KISS & fix preserve a dayMark Salyzyn2015-06-011-16/+9
| | | | | | | | | | | | | | | (cherry pick from commit 5921276a16528bf79292e828080bf0ec984cbb23) Code in 833a9b1e38ce65f2cdf3ebd095aaa99a92eb9467 was borken, simpler approach is to simply check last entry (to save a syscall) minus EXPIRE_HOUR_THRESHOLD. This does make longer logs less likely to call upon the spam detection than the algorithm being replaced, but sadly we ended up with a log entry in the future at the beginning of the logs confounding the previous algorithm. Bug: 21555259 Change-Id: I04fad67e95c8496521dbabb73b5f32c19d6a16c2
* logd: deal with sloppy leading expire messagesMark Salyzyn2015-06-011-10/+15
| | | | | | | | | | | | | | | | | | | | | | (cherry pick from commit 5392aac95d279a7ffc91d8fbcd074307186ca36c) The odds of chatty content also leading the logs is pretty high eg: 1799 12017 I logd: uid=10007 chatty comm=Binder_B, expire 4 lines 1799 1829 I logd: uid=10007 chatty comm=Binder_2, expire 4 lines 1919 20637 I logd: uid=10007 chatty comm=m.sersistent, expire 1 line 1919 20638 I logd: uid=10007 chatty comm=s.persistent, expire 1 line 1919 2316 I logd: uid=10007 chatty comm=UlrDispatch, expire 4 lines 19379 20634 I logd: uid=10045 chatty, expire 14 lines 19379 19388 I logd: uid=10045 chatty comm=lizerDaemon, expire 4 lines 591 4396 I logd: uid=1000 chatty comm=Thread-220, expire 5 lines 591 1377 I logd: uid=1000 chatty comm=Thread-92, expire 4 lines 1919 2267 I logd: uid=10007 chatty comm=WifiScanner, expire 4 lines 591 4397 I logd: uid=1000 chatty comm=DhcpClient, expire 4 lines 591 4398 I logd: uid=1000 chatty comm=Thread-222, expire 4 lines 226 580 D CommandListener: Setting iface cfg Change-Id: I5ab24bc7bf5d2690bae7e789831b07f23ff8bcc6
* logd: worst-UID only to preserve a dayMark Salyzyn2015-05-202-1/+26
| | | | | | | | | | (cherry pick from commit 833a9b1e38ce65f2cdf3ebd095aaa99a92eb9467) Do not invoke worst-UID pruning in the face of other UIDs logs that are more than a day old, switch to pruning oldest only. Change-Id: Icf988b8d5458400a660d0f8e9d2df3f9d9a4c2d9
* logd: Add TID statisticsMark Salyzyn2015-05-134-3/+120
| | | | | | | (cherry pick from commit 17ed6797df722464eb5cc6dfc3e1e32aec284b70) Bug: 19608965 Change-Id: Ifbf0b00c48ef12b5970b9f9f217bd1dd8f587f2c
* logd: CleanupMark Salyzyn2015-05-1312-119/+111
| | | | | | | | | (cherry pick from commit 7718778793b106498b931dd708a466cf3a6f6a0f) - Android Coding Standard for Constructors - Side effects NONE Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
* logd: Add klogdMark Salyzyn2015-05-139-24/+587
| | | | | | | | | | | | | | | | | | (cherry pick from commit ae4d928d816e30dbe57c2c321b0f0759d0567b3f) - Add a klogd to collect the kernel logs and place them into a new kernel log buffer - Parse priority, tag and message from the kernel log messages. - Turn off pruning for worst UID for the kernel log buffer - Sniff for 'PM: suspend exit', 'PM: suspend enter' and 'Suspended for' messages and correct the internal definition time correction against monotonic dynamically. - Discern if we have monotonic or real time (delineation 1980) in audit messages. - perform appropriate math to correct the timestamp to be real time - filter out any external sources of kernel logging Change-Id: I8d4c7c5ac19f1f3218079ee3a05a50e2ca55f60d
* logd: Add Tag statisticsMark Salyzyn2015-05-125-2/+110
| | | | | | | | | | | | | (cherry pick from commit 344bff4391dd434dda501e812f18f524290c5a7c) - Optional class of statistics for events Tags - export tagToName from LogBuffer (located in main.cp to address https://android-review.googlesource.com/#/c/110204) - Can not handle dropped because getTag() can not work, will need to be fixed if we start filtering. Bug: 19608965 Change-Id: I7b90607ca588bf37bab71f19b1570a290e772776
* logd: pidToName deficiencyMark Salyzyn2015-05-121-0/+4
| | | | | | | | (Cherry pick from commit aa43ae2268076227e8b72ea095f8aeac439b3168) any logging in zygote permanently sets the pidToName Change-Id: I0b8fdc96fb5965a04d4dc4293c39815beef5eb8e
* logd: uidToName add dex2oat UIDMark Salyzyn2015-05-121-2/+7
| | | | | | | | | | | (cherry pick from commit 023f51f360472f6bb9bad495e55cdb32b5411bc5) - When searching for uidToName from /data/system/packages.list one must search for the uid % AID_USER; - If uid % AID_USER is greater than AID_SHARED_GID_START - AID_APP, then subract it and try again to pick up uidToName. Change-Id: I24df42957ff7e746fffa5d39484637b1b726b9c0
* Revert "libaudit: limit to 5 selinux denials per sec"Nick Kralevich2015-05-111-1/+1
| | | | | | | | | | | | | | | | The shamu instabilities continued even after throttling SELinux denials to 5/second. 5 denials per second is too low when doing device bringup, and there have been some complaints about lost SELinux denials. See, for example, http://comments.gmane.org/gmane.comp.security.selinux/21941 Bring the limit back up to 20/second to prevent dropping too many denials on the floor. This reverts commit a15db51bbf961ff711d71c10d20e18ad2bfaef45. (cherrypick of commit 9667a66019388fb09430d3f8896ccc531eb24ef5) Change-Id: I05e85cce0a792d05aa557fcc614c0fc019c15014
* logd: class hierarcy for Uid and Pid statistics.Mark Salyzyn2015-05-073-137/+126
| | | | | | | | | | | | | | (Cherry pick from commit 81b3eabc49736b89c4f99940f79785074955eaa5) Add EntryBase and EntryBaseDropped base classes for statistical entries to inherit from. Abstract add(), subtract() and drop() methods to common LogBufferElement in each for entry policy decisions. Some move of details out of LogStatistics.cpp and place them into LogStatistics.h. Add statistical add(), subtract() and drop() methods to hash table to call entries for policy. Bug: 19608965 Change-Id: Ib8a33a8fe28871ef165d1632c6546a5c606231e8
* logd: improve details on chatty recordsMark Salyzyn2015-04-306-22/+111
| | | | | | | | | | | | | (Cherry pick from commit 21fb7e0b753b2251369bfaa1c6f6a09e58e64437) - Report applications UID, TID/PID by name. - change wording to have an accurate connotation - drop privilege check since filtered upstream Bug: 19608965 Bug: 20334069 Bug: 20370119 Change-Id: I2b1c26580b4c2de293874214ff5ae745546f3cca
* logd: reduce chance of dropped 1 messagesMark Salyzyn2015-04-301-1/+2
| | | | | | | | | | - do not time out at 1 second if drop has count of less than 4 (Cherry picked from commit 35173a9ac5bd1f4702ccfda3df02ec47ecb57949) Bug: 20334069 Bug: 20370119 Change-Id: I787cb553dfab5ed71abd6ed72b63de675f834e0c
* Merge "logd: per UID less aggressive 12.5% threshold"Mark Salyzyn2015-04-231-2/+9
|\
| * logd: per UID less aggressive 12.5% thresholdMark Salyzyn2015-04-221-2/+9
| | | | | | | | | | | | | | | | Per-UID quota has a threshold of 12.5% of the total log size. If less than that space is taken by the UID, then we will not engage the pruning based on worst UID. Change-Id: I9f15c9a26938f1115eb75e9c28ddb073e7680e06
* | logd: ratelimit drop messages to 1/secMark Salyzyn2015-04-221-4/+20
|/ | | | | | Bug: 20334069 Bug: 20370119 Change-Id: I6f850aec46c4df1c99a5b1f28db75d071e134ad5
* logd: Statistics headersMark Salyzyn2015-04-211-8/+25
| | | | | | Answer to the question "Bytes or Lines?" Change-Id: I352737265aeac63ea8d89e778d4222a9123bdf07
* logd: better drop message mergingMark Salyzyn2015-04-201-18/+70
| | | | | | | | | | - Former algorithm anlo coalesced adjacent records - New algorithm maintains a hash list of all drop records and coalesces them all. Bug: 20334069 Bug: 20370119 Change-Id: Idc15ce31fc1087c2cfa39da60c62feade8b88761
* logd: propagate ::log statusMark Salyzyn2015-04-155-24/+35
| | | | | | | | | | | | | Add a return value for the ::log() methods, this allows us to optimize the wakeup for the readers to only occur when the log message is actually placed. This is for a future where we may dedupe identical log messages, filter out log messages, and certainly if we filter the messages out with an internal logd check of __android_log_is_loggable(). Change-Id: I763b2a7c29502ab7fa0a5d5022c7b60244fcfde4
* Merge "logd: syscall optimization"Mark Salyzyn2015-04-156-7/+21
|\