Hacker News new | ask | show | jobs
by gdulli 3671 days ago
I go one big step further than this and log everything that comes across the screen.

One time it saved me from a crontab -r that wiped out a 100+ line crontab. I had viewed it recently so I just copied it out of my history.

On a day to day basis it's more about looking up old queries I typed out, the results of those queries at that time, bash commands and their results, the state of a file I edited at a certain time, a stack trace, the output of an ls -l command, etc. Anything I ever do in a session.

Some of those have their own logs or ways to capture history, but a way to capture everything at once is much more comprehensive and less sensitive to forgetting to set the size of the bash history on a given machine, archiving the bash/psql history files when a machine goes away, etc.

And besides not having to worry about the availability of distributed history/log data, being able to grep everything at once is invaluable.

4 comments

Could you share a gist of that? Would love similar thing in my toolset!
I don't do it with code, it's a feature of this product: https://www.vandyke.com/products/securecrt/
not the OP, but this discussion might be helpful

http://unix.stackexchange.com/questions/25639/how-to-automat...

I have been wondering about doing something like this as well

How do you do this?
Session logging with this client: https://www.vandyke.com/products/securecrt/
This could be done using

  script
as well.
script gives you the whole console, including output and control characters. It's a useful tool but might be a little overkill for keeping track of what commands you have run.
install rootsh and set that to your shell. Set the logging directory to something in ~/ with 0600 perms, and away you go!