Reputation
338
Top tag
Next privilege 500 Rep.
Access review queues
Badges
1 3 12
Newest
 Excavator
Impact
~117k people reached

Jul
12
comment Switch on PAM debugging to Syslog
/var/log/auth.log is syslog. The problem is not logging but debugging. If for example the PAM stack fails early, you will not see anything, because the modules which output to syslog are not invoked at all. Or something fails and something not, but both log exactly the same lines. It is correct that, I guess, 95% of all cases can be solved by looking into the usual logs, but 5% cannot, as there simply is no trace of what really happens behind the scenes.
Apr
30
awarded  Nice Question
Feb
22
comment Command to prepend string to each line?
awk -v T="[TEST %Y%m%d-%H%M%S] " '{ print strftime(T) $0 }' to output a timestamp
Feb
22
answered Command to prepend string to each line?
Feb
21
comment Command to prepend string to each line?
sed X cmd does read cmd and does not execute it. Either cmd | sed 's/^/[ERROR] /' or sed 's/^/[ERROR] /' <(cmd) or cmd > >(sed 's/^/[ERROR] /'). But beware the latter. Even that this allows you to access the return value of cmd the sed runs in background, so it is likely you see the output after cmd finished. Good for logging into a file, though. And note that awk probably is faster than sed.
Feb
21
comment Command to prepend string to each line?
T="[ERROR] " awk '{ print ENVIRON["T"] $0 }' or T="[ERROR]" awk '{ print ENVIRON["T"] " " $0 }'
Feb
21
comment Command to prepend string to each line?
awk -vT="[ERROR] " '{ print T $0 }' or awk -vT="[ERROR]" '{ print T " " $0 }'
Feb
20
comment Switch on PAM debugging to Syslog
Thanks. Good hint. I'll try if I ever have problems again. So hopefully never .. ;)
Jan
3
comment why is kswapd using high CPU on an idle system?
Please note that the kswap hanging at 100% was confirmed being a Linux bug. It was fixed in mid/end 2012 kernels.
Dec
21
awarded  Revival
Dec
21
awarded  Yearling
Nov
14
awarded  Famous Question
May
26
comment LVM thin provisioning
But it is currently disabled in Wheezy (LVM 2.02.95-7) as thin_check binaries are missing.
May
24
comment How to find the gateway IP address in Linux
I would suggest something like route -n|awk '$4~/G/{print $2; exit(0)}' for the first gateway, but ip route get IP is better, because it lists the route which would be really taken to the given IP, which is difficult to find with route alone
May
24
comment How to find the gateway IP address in Linux
read x x i x< <(ip r g 1), result is in variable $i for further use
Mar
28
comment Easy way to get IP address from hostname using a Unix shell
Because shell traditionally is seen as scripting, not programming ;)
Mar
28
answered How do I tell what process is causing kswapd to be in use?
Mar
28
answered why is kswapd using high CPU on an idle system?
Aug
30
awarded  Commentator
Aug
30
comment Remote IP's with HAProxy
Better use option forwardfor header X-Real-IP and reqidel ^X-Real-IP:, this stops faking IPs in your logs. FYI: X-Real-IP is the default header for NginX' option set_real_ip_from.