
tail
Source (link to git-repo or to original if based on someone elses unmodified work):
Main goal was to track /var/log/emerge.log on Gentoo linux, but it functions just as well for any other file.
this version is almost complete: basic functionality is already there - it tracks the changes and displays notifications.
tracking several files means creating several instances of this plasmoid.
There are other plasmoids that would track the output of shell command - this one was build for sheer simlicity and convenience.
1.0
- fixed some minor bugs
- tested on KDE-4.6.2 (Fedora-based)
1.0b4
- cleaned-up configuration screen
- added notification pooling to work around "KNotify spamming".
1.0b3
- added configuration option for KNotify message length
1.0b2
- forced data reload on startup. Now the state should be preserved fine between sessions.
1.0b1
- added configuration options and config preservation
1.0a3
- fixed spamming via KNotify. Now it tries to truly follow file and not dump contents of last 4K of file
1.0a2
- added exception handling for cases of missing /var/log/emerge.log (sorry to non-getnoo folks )
Ratings & Comments
19 Comments
hi really a nice tool but it needs some improvements after "> file" to reset it will no longer refresh in the current session and should be cleared too some years ago i solved this by using "tail -n 10" to get the latest 10 lines and call this in a fixed interval if file does not exist at session start (remote mount points - would also be solved by using "tail -n lines" in a fixed interval with supressing errors
"after "> file" to reset it will no longer refresh in the current session and should be cleared too" Depends on what you write to the file. On my system (ubuntu with old kde) it works. If you remove the file the plasmoid will stop. However, it won't continue if your observed data is restored. That's a bit annoying.
"> file" writes nothing to it, it makes the file empty and the plasmaoid will show the old content forever i think "tail -f" is not really relieable and should be replaced with "tail -n", this would not be a problem if the mount-point is even temorary not available
I'm afraid your new version is no longer backwards-compatible with KDE 4.4.* the combo gadget for selecting the file is gone :( That's too bad, because it's reaaly good. Suggestions :search for a word and color it
in config window :
string to search for <field> change color to <color menu> (simple, basic 8 colors)
Merge several logs together
in config window :
Log 1 <field + openfile button>
Log 2 <field + openfile button>
Log 3 <field + openfile button>
Separate : <radio button yes/no>
Separator character : <restricted text field>|<basic "-, _, # menu>
Thank you very much for your time/work
I'll take a look, but I have no access to 4.4 anyplace (I do have older version kicking around so I can post it too if needed).
Nice, although similar to the filewatcher plasmoid. Two things I want to suggest: 1) Configurable font. I would like to make the font somewhat smaller. 2) An option to act like tail --follow=name. Tail -f normally follows the inode, so when the file is being renamed (e.g. by logrotate), the new file will not be monitored.
I'll take a look - font is relatively easy, inode tracking may be a bit tricky as I'd have to change how I'm tracking things. But looks doable.
How do you use this thing? It's sitting on my desktop saying "No file specified" and there's nothing in the settings that allows to specify which file to watch. Debian squeeze / KDE 4.4.5
right-click and go to "Tail settings"
Seems broken (with Kde 4.6.2), there is no field to enter a file name? Anyway, from the source code it's clear that the applet requires a TailFileName field in ~/.kde/share/config/plasma-desktop-appletsrc So if others run into this they only have to configure the number of entries they want, then search the config file for TailSize and add the TailFileName entry there.
Just uploaded 1.0 that works on my KDE-4.6.2 setup (Fedora-14 with KDE-testing repo). Let me know if it helps.
Got the following error trying to run it on KDE 4.4 RC2 plasmoidviewer tail.plasmoid plasmoidviewer(19838)/plasma main: setting FormFactor to "planar" plasmoidviewer(19838)/plasma main: setting Location to "floating" plasmoidviewer(19838)/plasma main: setting containment to "null" plasmoidviewer(19838)/plasma main: setting auth policy plasmoidviewer(19838)/plasma main: just load applet plasmoidviewer(19838)/plasma FullView::addApplet: adding applet "tail.plasmoid" in "null" plasmoidviewer(19838)/libplasma Plasma::CoronaPrivate::addContainment: loading of containment "null" failed. plasmoidviewer(19838)/kdecore (KSycoca) KSycocaPrivate::openDatabase: Trying to open ksycoca from "/var/tmp/kdecache-sbrown/ksycoca4" plasmoidviewer(19838)/libplasma Plasma::AppletPrivate::init: Check your constructor! You probably want to be passing in a Service::Ptr or a QVariantList with a valid storageid as arg[0]. plasmoidviewer(19838)/libplasma Plasma::Applet::load: offers is empty for "tail.plasmoid" plasmoidviewer(19838)/libplasma Plasma::ContainmentPrivate::addApplet: Applet "tail.plasmoid" could not be loaded. plasmoidviewer(19838)/libplasma Plasma::AppletPrivate::init: Check your constructor! You probably want to be passing in a Service::Ptr or a QVariantList with a valid storageid as arg[0]. plasmoidviewer(19838)/libplasma Plasma::FrameSvg::resizeFrame: Invalid size QSizeF(0, 0)
hmm. looks suspiciously like problem in KDE bindings for python. I've got no KDE 4.4 box yet to confirm. Once 4.4 goes live I'll upgrade and check it out. Thanks for early warning!
Looks like RC2 is borked to begin with: http://forum.kde.org/viewtopic.php?f=67&t=85368
[first@MyComp ~]$ plasmoidviewer tail Traceback (most recent call last): File "/usr/share/kde4/apps/plasma_scriptengine_python/pyappletscript.py", line 53, in init self.pyapplet = self.module.main.CreateApplet(None) File "/home/first/.kde/share/apps/plasma/plasmoids/tail/contents/code/main.py", line 171, in CreateApplet return Tail(parent) File "/home/first/.kde/share/apps/plasma/plasmoids/tail/contents/code/main.py", line 64, in __init__ self.follow=Follow('/var/log/emerge.log',size=10,lookback=14096) File "/home/first/.kde/share/apps/plasma/plasmoids/tail/contents/code/main.py", line 16, in __init__ self.file=open(self.filename,'r') IOError: [Errno 2] No such file or directory: '/var/log/emerge.log' [first@MyComp ~]$ touch /var/log/emerge.log touch: cannot touch `/var/log/emerge.log': Permission denied [first@MyComp ~]$ su -c "touch /var/log/emerge.log" [first@MyComp ~]$ su -c "chown -R first /var/log/emerge.log" [first@MyComp ~]$ plasmoidviewer tail [first@MyComp ~]$ In short, this plasmoid requires a file /var/log/emerge.log to be present in order to run at all. Creation of that file requires root privileges. Also plasmoid name is a bit misleading because it can only display text files.
just realized it last night myself :) I'll upload a2 revision shortly.
re:misleading name although you could use command line "tail" to trail binary files I haven't come across such usage. most tail uses are around text files - thus the name for the applet :)
Well, you're probably right about that, but it would be nice for plasmoid to display some command's output. Of course, that can be also achieved by defining cron job which then outputs command to text file, but such approach wouldn't be that convenient.
what you may be looking for is: http://kde-look.org/content/show.php/STDIN+Plasmoid?content=92309 but for my purposes I wanted just the "tail" part to keep it simle and tidy :)