Simple filter for no suffix, or a numerical suffix. toybox
grep did not handle a more robust regex, so we opted for
kiss in order to remove the .id suffix from consideration.
Bug: 30591615
Change-Id: I5b1c929d3e69c1ae39af95ae44a69f7b55e969ed
Clear file rotate content if id signature changes. This allows
logcatd to detect change of property ro.build.id to reset the
recorded data. The id is stored in the the -f filespec as
<filespec>.id.
If the id file is missing or unreadable, do not clear. Allow an
API where chmod 0 to the id file blocks this feature. Does not
work for root.
Add logcat.logrotate_id gTest.
Bug: 30591615
Change-Id: I895749ca7c6d4af57ec57f058a29d8e3af2f8b27
asprintf should be replaced with StringPrintf, solves
a memory leak issue because of exiting scope.
Bug: 30591615
Change-Id: I88644cc27946ba4f25d4539420199c6f40df1bfa
"killing Settings" is meaningless without context, we are killing the
Settings application to pull in new values, so make this clearer!
Change-Id: Ice0b950040bd05dcd49b7315def4dac3dd93eb27
Best practices so that device can set logd.logpersistd properties.
Values can be overriden with trampolines for persist.logd.logpersistd
values except as designed for empty content to keep out of the way.
This allows us to set logd.logpersistd* for a non-persistent collection
that does not survive a reboot, and to use persist.logd.logpersistd*
for persistent collection that does survive a reboot.
Added logd.logpersistd.enable to gate when logpersist service can be
run allowing the properties to be adjusted safely prior to this state
as is the case for device property.
NB: /init will complain when trying to trampoline an empty property,
this is acceptable for functionality, but may be considered
annoying from the logging perspective.
Bug: 28936216
Bug: 29831823
Change-Id: I97317e8eedfae4daa8e3ef39e64e7c5c23d8b573
- add stop and clear (and stop) actions to logcatd.rc
- use stop and clear actions in logpersist script
Bug: 28936216
Change-Id: Id05118fb51e40609fd7b3a934cf9302f67ef6d1d
If -c and -f are both specified, clear the files rather
than notifying the logger to clear its data. The -f then
acts like a switch between clearing the in-memory log
data, or the on-disk logrotate data.
Bug: 28936216
Change-Id: Ib1d1fb46ea09f81a2fd9bebb6c8f0f9f2355f6e8
Changes expected output from a line cut from the less than portable
ps output to reporting the pid of logcatd (uid=logd comm=logcat).
Preserve reporting an error code if logcatd did not start.
Bug: 29075536
Change-Id: I61aa0a4787d4594c415d2c7db5bbb0e512676bf8
- Add hidden -n and -b flags that propagate to the underlying
logcat command. Publish aliases in help as --size and --buffer.
- Add --clear for start command so it clears before starting
- shell script bloating up to deal with option validation and
provide ERROR: and WARNING: advice.
ToDo:
- Deprecate shell script and replace with Eng and Userdebug
only Developer Options, before it becomes too powerful
or bloated to force us to rewrite an expendable like this
into C++.
Bug: 28120456
Change-Id: I0dff8acaa1e5c929454760cfa2801924956bc25d
- Add property expansion to the -n/--rotate-count,
-r/--rotate-kbytes and -b/--buffer parameters.
e.g. -r '${logcat.rotate-count:-6}' will expand the property
logcat.rotate-count, and if not present will default to 6
- Add gtest to confirm mid-stream expansion
- No longer support ",:;<whitespace>" for buffer tokenization,
settling on only supporting ",".
Bug: 28120456
Change-Id: I7ebb6146f72047631536c457952fa50d0abb98ab
- Add parsing to support comma+ separated list of buffers.
- Move get_size test into a standalone get_groups function
- add some additional tests for this feature, leveraging
get_groups to confirm buffer selection.
Bug: 28120456
Change-Id: I0b42736c08cf4b2a435cb74cda540dc163a26bd1
It is not clear about the long option aliases, list
them comma separate first for clarity. Squash lines
of help content if possible. Lock to 3 indents, one
for options, another for text on same line as options
and another for next line or continuation.
Bug: 28120456
Change-Id: I5331acde3ac0fd3b87f6699ba108f6cef46a1563
- Check if the result of opendir is NULL in lastLogTime
- Cleanup: alphabetically sorted long options, reserved
an alias for --regex
- Add a unit test, non existent directory should return
gracefully with an exit(1) and not SIGSEGV.
NB: This failure was with eng/debug feature logpersist
turned on, /data/misc/logd/ directory was missing,
deleted, or temporarily inaccessible.
Bug: 27954627
Change-Id: I60246a53b02fdd7e5490fe458b02ad7b14843584
To be used in combination with --regex and --max-count flags
to allow all prints to pass through, but still stop when
max-count is hit.
Bug: 27706081
Change-Id: Idaa9f0b44586a885b9d9f367824b0072c0853227
- change _ to - for long arguments
- added --tail as hidden undocumented alias for -t
- added --head as hidden undocumented alias for --max-count
Bug: 27706081
Change-Id: I614cc83ae56b305b267f64ed05dc3ed3027dabd4
- Do not restrict regex on LOG_ID_EVENTS or LOG_ID_SECURITY.
- some logcat_panic messages need to incorporate a newline.
- deal with some coding standards issues.
Bug: 27706081
Change-Id: Ie647fd62d027b01004177559d68b8e5a346705e6
This new option causes logcat to quit after it prints N messages.
Test: New unit test passes
Bug: 27706081
Change-Id: Ie52ddf300160a041e68a6bac0ae7ade68bb28a7c
You can now filter log output by a regex on the messages.
Test: New unit test passes
Bug: 27706081
Change-Id: Idfa637f62a25fb1b92e9b49b89572dff0fec6e08
Always ANDROID_LOG_WRAP_DEFAULT_TIMEOUT seconds (2 hours).
--wrap takes argument, the argument is currently ignored.
Future: Add new API that allows setting of wrap timeout.
Bug: 25929746
Bug: 21615139
Change-Id: Ib441cecfb6e4264c18adb70c705314440ba85e65
Add long arguments file, rotate_kbytes, rotate_count, format,
dividers, clear, buffer_size, last, buffer, binary, statistics
and prune.
Bug: 21615139
Change-Id: Ieb1bbe3d47e6711a1e91c74522630d39f8981621
android_log_timestamp returns the property leading letter,
it is better to return a clockid_t with android_log_clockid()
Bug: 23668800
Change-Id: I38dee773bf3844177826b03a26b03215c79a5359
android_log_timestamp returns the property leading letter,
it is better to return a clockid_t with android_log_clockid()
Bug: 23668800
Change-Id: I3c4e3e6b87f6676950797f1f0e203b44c542ed43
if ro.logd.timestamp or persist.logd.timestamp are set to the value
monotonic then liblog writer, liblog printing and logd all switch to
recording/printing monotonic time rather than realtime. If reinit
detects a change for presist.logd.timestamp, correct the older entry
timestamps in place.
ToDo: A corner case condition where new log entries in monotonic time
occur before logd reinit detects persist.logd.timestamp, there
will be a few out-of-order entries, but with accurate
timestamps. This problem does not happen for ro.logd.timestamp
as it is set before logd starts.
NB: This offers a nano second time accuracy on all log entries
that may be more suitable for merging with other system
activities, such as systrace, that also use monotonic time. This
feature is for debugging.
Bug: 23668800
Change-Id: Iee6dab7140061b1a6627254921411f61b01aa5c2
- '-v epoch' prints seconds since Jan 1 1970
- '-v monotonic' print cpu seconds since start of device
- '-T sssss.mmm...' as alternate tail time format
NB: monotonic is a best estimate and may be out by a few ms
given the synchronization source clue accuracy.
Bug: 23668800
Change-Id: Ieb924b6d3817669c7e53beb9c970fb626eaad460