cockpit-project / cockpit

Cockpit is a web-based graphical interface for servers.
http://www.cockpit-project.org/
GNU Lesser General Public License v2.1
11.23k stars 1.11k forks source link

Logs : remember last settings, pagination, show only last N lines, clean #18220

Open warlordattack opened 1 year ago

warlordattack commented 1 year ago

Page: Logs

Hello beautiful people, I use cockpit on all my linux VMs, like Home assistant Supervised debian. One feature i use a lot is Logs. It lets me see everything happening inside my home assistant VM.

Every time i open Logs page i configure like this : -current boot -warning and above

Would be nice to add following : -cockpit remember automaticly my last settings so i don't need to set them again every time -add pagination or let me see only last N lines (by default it shows millions of lines and there is no way to change that) -add some features to find growing log and other files, see size, and clean them

Usually i use "ncdu /" to find big files, than something like this :

#logs
    for logfile in $(ls /var/log/*.1)
    do 
        truncate -s 1 $logfile
        mysize=$(find "$logfile" -printf "%s")
        echo "file : $logfile ---> size : $mysize"
    done

# journal
    journalctl --disk-usage
    journalctl --rotate
    journalctl --vacuum-time=1m
    journalctl --vacuum-size=50M
    journalctl --disk-usage

# kernels
    dpkg --list | egrep -i --color 'linux-image|linux-headers'
    x=$(dpkg --list | grep -i linux-image | grep ^rc| awk '{ print $2}')
    echo "$x"
    apt-get --purge remove $x

# apt
    sudo apt autoremove -y
    sudo apt autoclean -y

# nala
    nala fetch --country fr
    nala update
    nala upgrade
    nala clean
    nala autopurge

# destroy my docker
    docker image prune -a
    docker container prune --filter "until=24h"
    docker system prune --all --volumes --force

(chances are the code above is dumb, because i am linux beginner, so i most time don't know what i'am doing)

Best regards :)

marusak commented 1 year ago

cockpit remember automaticly my last settings so i don't need to set them again every time

We update url on filtering changes so you can bookmark it for workaround if you always use the same search.

-add pagination or let me see only last N lines (by default it shows millions of lines and there is no way to change that)

We don't use pagination anywhere and we don't plan on doing so. We don't show millions of lines but we default to 5000 entries. But we show them with --reverse which means we show the newest first. You want to see the oldest ones first or how do you mean "only last N lines"?

-add some features to find growing log and other files, see size, and clean them

This is what https://github.com/cockpit-project/cockpit/issues/14083 asks for. I still find it a somewhat corner-case-ish feature as it is not as simple as "Clean my logs" but some more vigilance is necessary (as you see in your own script).