Questions tagged [logging]

Recording activity on the system (or of a particular program) for later reporting and analysis. Logins, logouts, web server page requests, etc might all be logged.

2917 questions
164
votes
22 answers

How to add a timestamp to bash script log?

I have a constantly running script that I output to a log file: script.sh >> /var/log/logfile I'd like to add a timestamp before each line that is appended to the log. Like: Sat Sep 10 21:33:06 UTC 2011 The server has booted up. Hmmph. Is there any…
144
votes
4 answers

Is my password compromised because I forgot to hit Enter after ssh username?

I've just tried logging into a Fedora (release 13 Goddard) server using SSH (PuTTY, Windows). For some reason the Enter after typing my username didn't go through and I typed in my password and hit Enter again. I only realized my mistake when the…
106
votes
2 answers

How can I send a message to the systemd journal from the command line?

In older Linux systems, the logger command can be used to send a log message to syslog. Reading where does logger log its messages to in Arch Linux? , it seems that syslog messages and the logger command line app only talk to the systemd journal if…
mikemaccana
  • 3,792
93
votes
9 answers

Is there a proper way to clear logs?

I was wondering if there was a proper way to clear logs in general? I'm new to Ubuntu and I'm trying to set up Postfix. The log in question is /var/log/mail.log . I was wondering if there was a correct way to clear it, rather than me going in it and…
mastofact
  • 1,033
  • 1
  • 8
  • 5
92
votes
7 answers

Make a Docker application write to stdout

I'm deploying a 3rd-party application in compliance with the 12 factor advisory , and one of the points tell that application logs should be printed to stdout/stderr: then clustering software can collect it. However, the application can only write…
kolypto
  • 11,678
84
votes
7 answers

Log all commands run by admins on production servers

It is company policy for admins to login to the servers via a personal username, and then run sudo -i to become root. Upon running sudo -i , sudo will create an environmental variable called SUDO_USER , which contains the original user's username.…
Soviero
  • 4,436
74
votes
12 answers

Do you have any useful awk and grep scripts for parsing apache logs?

I can use log analyzers, but often I need to parse recent web logs to see what's happening at the moment. I sometimes do things like to figure out top 10 ips that request a certain file cat foo.log | grep request_to_file_foo | awk '{print $1}' |…
72
votes
4 answers

Better logging for cronjobs? Send cron output to syslog?

I am looking for a better way to log cronjobs. Most cronjobs tend to spam email or the console, get ignored, or create yet another logfile. In this case, I have a Nagios NSCA script which sends data to a central Nagios sever. This send_nsca script…
65
votes
2 answers

Where are the logs for ufw located on Ubuntu Server?

I have an Ubuntu server where I am blocking some IPs with ufw . I enabled logging, but I don't know where to find the logs. Where might the logs be or why might ufw not be logging?
blockhead
  • 911
64
votes
5 answers

Equivalent of logrotate on OSX

Is logrotate hiding somewhere on OSX, or is there an equivalent? It's not in /usr/sbin .
61
votes
6 answers

The corporate benefits of using MSI files

What are the advantages of using .msi files over regular setup.exe files? I have the impression that deployment is easier on machines where users have few permissions, but not sure about the details. What features does msiexec.exe have that makes…
54
votes
3 answers

How do I find out the W3SVC number of a given IIS7.5 website?

I have a server running multiple websites under IIS7.5. I want to view the log files for one website in particular. In C:\inetpub\logs\LogFiles I see a number of folders, W3SVC1 through 6. How do I find out which website corresponds to which folder?…
Liam
  • 673
53
votes
12 answers

Tail multiple remote files

Is there a way to remote tail 2 files? I have two servers(a and b) behind a load balancer and I would like to do something like this if possible: tail -f admin@serverA:~/mylogs/log admin@serverB:~/mylogs/log Thanks!
48
votes
7 answers

View content of memcached

Are there any tools to explore what is currently cached inside a memcached pool? Not some much graphs, but the actual key/values currently stored.
Tom
  • 796
48
votes
11 answers

Delete all of /var/log?

Can I delete everything in /var/log ? Or should I only delete files (recursively) in /var/log but leave folders? Does anyone have a good rm command line? (My admin skills leave me nervous.) Note: I am using Debian. I am not sure what version.
user274
1
2 3
…
99 100