Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 693054 - app-portage/portage-utils: Please add reading from compressed log‐files
Summary: app-portage/portage-utils: Please add reading from compressed log‐files
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-29 06:50 UTC by Massimo Burcheri
Modified: 2019-08-30 06:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Massimo Burcheri 2019-08-29 06:50:05 UTC
In order to fully replace genlop with qlop, one missing option for
-f <arg>, --logfile <arg>
is reading from compressed log‐files.

As my /var/log/emerge.log is part of logration with compression, I need to read all of them for proper statistics.

# cat /etc/logrotate.d/emerge
/var/log/emerge.log {
    create 660 portage portage
    rotate 2
    size 2M
    maxage 220
    nodateext
    compresscmd /bin/bzip2
    uncompresscmd /bin/bunzip2
    compressext .bz2
}

Additionally it would be convenient to support passing multiple files to -f for avoiding that snippet:

# type genlop
genlop is a function
genlop () 
{ 
    local opts args;
    for args in "$@";
    do
        opts+=("$args");
    done;
    for logfile in /var/log/emerge.log*;
    do
        if [[ -r "$logfile" ]]; then
            opts+=(-f "$logfile");
        fi;
    done;
    command genlop "${opts[@]}"
}

Reproducible: Always
Comment 1 Fabian Groffen gentoo-dev 2019-08-30 06:46:18 UTC
Hmm, this makes sense to me.  Since we already have compression detection for qxpak, I guess this could be reused.  I need to think a bit about how to do the multi-files, there's two ways:

1.) just process one after the other, as if we'd call qlop -f <file>
2.) internally concatenate all files

1. is most simple to implement and has best memory/performance characteristics, but would also be implementable as script (like you currently do).

2. would be able to "see" emerge chains through rotated logs, which makes it more useful, but it will take more resources.

I'd personally go for 2. which a bit more work, but sounds like what you're after here.