Forum › Forums › New users › New Users and General Questions › How can I switch OFF desktop session logging
Tagged: disable restrict logging
- This topic has 10 replies, 6 voices, and was last updated Apr 25-11:41 am by Dave.
-
AuthorPosts
-
March 26, 2022 at 11:46 am #79815Member
ModdIt
On a fixed environment for multiple users the desktop session logs are way too revealing especialy in regard to search terms in browsers,
which browsers were used at which time is also clearly shown. This has intended usage as a large family kiosk system to also be used by visitors
so it is not practical to create a home for each user.Despite forum searching and trawling system files I have not found a way to either switch off the logging completely,
or preferably only log errors and warnings.Would be very grateful to any pointers. For now, in desperation I am going to run a delete job and delete on every desktop session start
which is far from an ideal solution.If the answer is right in front of my nose please tell me where, i will then say sorry. 🙂
March 26, 2022 at 1:03 pm #79834Member
sybok
::Hi, how about the below 2 hacks:
1) Emptying the log-file and removing the write permissions?
:> <log-file>; chmod a-w <log-file>
This is a hack that might ensure no logging.
Hopefully, nothing fails terribly because of this change.2) A background script (started when logging in[to the session]) deleting all lines not containing string ‘error’, basically:
sed -i '/[Ee]rror/!d' <log-file>
The issue is that when it may run when some application attempts to write into the log resulting into a lot of mess.
And it can remove context necessary to understand the error-line.3) Find where is the logging set up?
Find all relevant files (the laziest/dummiest thing is to search the whole system ‘/’) and grep ‘current.log’.
find / -type f -name '*' 2>/dev/null | sort > FLY.txt
Remove some that you know are worthless and then iterate and grep ‘current.log’
while read -r f; do [ -n "$(grep 'current\.log' "$f" 2>/dev/null)" ] && echo "$f"; done < FLY.txt
Beware of the potentially harmful results of grep from binary files.EDIT: The package ‘desktop-session-antix’ lead me (via ‘apt-file search desktop-session’) to folder ‘/usr/local/lib/desktop-session/’.
The LOG file is set in ‘desktop-session-file-locations.sh’ and there is a BASH script ‘lib-logging-ds’ authored by none other but Dave.- This reply was modified 1 year, 1 month ago by sybok. Reason: Fix/Improve grep in item 3)
- This reply was modified 1 year, 1 month ago by sybok.
March 26, 2022 at 1:20 pm #79837Forum Admin
anticapitalista
::This is a good question, one I cannot answer …
There should be an easy way to turn off logging.
Dave will know.Philosophers have interpreted the world in many ways; the point is to change it.
antiX with runit - leaner and meaner.
March 26, 2022 at 8:17 pm #79872Moderator
Brian Masinick
::If you know where the offending log files are located, then you can write a script that can regularly check the location / locations and remove any files older than 1 day, 1 hour, 1 minute, or whatever scenario makes the most sense.
If you are familiar with either cron or anacron, you could then put this script under automated control and run it at regular intervals of your choice.
--
Brian MasinickMarch 27, 2022 at 3:51 am #79882Forum Admin
Dave
::This is a good question, one I cannot answer …
There should be an easy way to turn off logging.
Dave will know.Yes, keyword *should*. Never really was a thought to me before to be honest.
What kind of levels of are we thinking of having; just on / off?
Where should this setting / level be stored? (I would say ~/.desktop-session/desktop-session.conf but then if already logged in, the setting can simply be re-enabled)Unfortunately I feel like changing the log file permissions / making the file immutable as sybok says will likely cause various parts of desktop-session to crash or fail to function in some other way… do not know for certain though (have not tried).
Using a cron job / script like Brian says should work, but better to achieve this by altering lib-logging-ds (/usr/local/lib/desktop-session/).
With a quick edit, this should log only warnings/errors (not really tested).\#!/bin/bash #Name: lib-logging-ds #Version: 1.0 #Depends: #Author: BitJam, Dave #Purpose: Logging library for desktop-session #License: gplv3 ME=${0##*/} fatal() { echo "$ME: Fatal Error: $*" exit 2 } error() { echo "$ME Error:" >&2 echo "$*" >&2 exit 2 } warn() { echo "$ME: Warning: $*" ; } say() { echo "" ; } log() { echo "" >> $log_file ; } shout() { echo "" | tee -a $log_file ; } psay() { say "$(plural "$@")" ; } echo_variable() { #echo "$ME: Setting environment variable: $*" export "$@" } echo_cmd() { #echo "$ME: run: $*" "$@" 1>/dev/null } echo_eval_cmd() { #echo "$ME: run: eval $*" eval "$@ 1>/dev/null" & } echo_bg_cmd() { #echo "$ME: run: $* &" "$@" 1>/dev/null & } log_rotate() { date=$(date +%Y-%m-%d_%H-%M); log_amount="5"; if [ -e "$log_file" ]; then mv "$log_file" "$user_dts_dir/old-log-$date.log"; else touch $log_file; fi log_list=$(find "$user_dts_dir" -maxdepth '1' -iname "*.log") log_file_count=$(echo $log_list |wc -l) if [ "$log_file_count" -lt "$log_amount" ]; then for item in $( stat -c "%X|%n" $log_list |sort -r |tail -n "+$log_amount" 2> /dev/null ) do file=$(echo "$item" | cut -d "|" -f2) rm $file; done fi }I would imagine on quick scan making a logging level option should be achievable by altering this file to have a few conditional statements. Where should the option to change the log level be stored. (maybe in ~/.desktop-session/desktop-session.conf but the system admin can lock it by making file immutable / mutable as root via chattr +/-i desktop-session.conf )
- This reply was modified 1 year, 1 month ago by Dave.
Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown
March 27, 2022 at 8:45 am #79886MemberModdIt
::Hi Dave,
thanks for joining in. Logging level, definitely option of choice.Not for me to decide but maybe as you suggest best to keep the file in same user accessible place with lock option.
Logging level Errors and Warnings, Only readable by root would be best for present little problem.Being privacy concious I would definitely prefer that to be the default for antiX.
Privacy is one of the biggest arguments for moving away from windoze, here in relatively rich Germany anyway.
Relatively rich as about 30% of the population live in poverty, figure rising rapidly.April 24, 2022 at 8:33 pm #82038Forum Admin
Dave
::@ Moddit,
If you are comfortable navigating git/Gitlab please see here Gitlab desktop-session for changes to desktop-session to allow for setting logging levels. If you do not mind testing, I have not tested this thoroughly; Though I have submitted this as a merge request / update to anticapitalistaComputers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown
April 24, 2022 at 9:03 pm #82042Member
iznit
::admin can lock it by making file immutable / mutable as root via chattr
chattr may be impossible during liveboot or frugal, right?
maybe possible if static home persistence is in effect? [[[not a tmpfs filesystem]]]April 25, 2022 at 1:06 am #82045Forum Admin
Dave
::admin can lock it by making file immutable / mutable as root via chattr
chattr may be impossible during liveboot or frugal, right?
maybe possible if static home persistence is in effect? [[[not a tmpfs filesystem]]]Not sure, did not try…
Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown
April 25, 2022 at 5:20 am #82046MemberModdIt
::@Dave, many thanks for the attention to the logging issue, would like to test, but unsure how to incorporate the proposed changes correctly.
Be nice if you would give a mini howto, maybe get more persons interested in testing that way too.April 25, 2022 at 11:41 am #82048Forum Admin
Dave
::Sure.
apt update && apt install git
git clone https://gitlab.com/antiX-Dave/desktop-session-antix
The 4 files listed in the commit backup and copy over. The one bin/desktop-session will be /usr/local/bin/desktop-session. The 3 from desktop-session-lib/ will be in /usr/local/lib/desktop-session/. After backed up and copied over logout / back in and try adjusting the log level in desktop-session.conf (you may want to backup desktop-session.conf as well)sudo apt update && apt install git mkdir -p ~/git/backups cp /usr/local/bin/desktop-session ~/git/backups cp /usr/local/lib/desktop-session/desktop-session-xdg-dirs.sh ~/git/backups cp /usr/local/lib/desktop-session/ds-config-check ~/git/backups cp /usr/local/lib/desktop-session/lib-logging-ds ~/git/backups cd ~/git git clone https://gitlab.com/antiX-Dave/desktop-session-antix cd desktop-session su root cp bin/desktop-session-antix /usr/local/bin/ cp desktop-session-lib/desktop-session-xdg-dirs.sh /usr/local/lib/desktop-session/ cp desktop-session-lib/ds-config-check /usr/local/lib/desktop-session/ cp desktop-session-lib/lib-logging-ds /usr/local/lib/desktop-session/ exit desktop-session-exit -l- This reply was modified 1 year ago by Dave.
Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown
-
AuthorPosts
- You must be logged in to reply to this topic.