Skip to main content

All Questions

Tagged with
0 votes
2 answers
75 views

Prevent application (iscsiadm) logging to dmesg?

I have an issue where running sudo iscsiadm -m discovery -t st -p IP -l logs to dmesg across all terminals on the server. The command is run from a java application, using: Runtime.getRuntime()....
Kris Rice's user avatar
  • 101
6 votes
1 answer
20k views

Journalctl shows logs from about last hour only

I have a problem with journalctl logs, which doesn't show me logs older than about one hour. First log entry is from about one hour ago, instead of 2 days as requested. $ date -u Wed May 13 08:59:21 ...
Jakub Kuszneruk's user avatar
0 votes
0 answers
23 views

Linux - How to make grep show the next line too [duplicate]

I am using grep to see a log of one of our systems. When I type "cat server.log | grep PPHI245" it shows the output below: But, when I type just "cat server.log" it shows the output below: Look ...
WitnessTruth's user avatar
0 votes
3 answers
2k views

How to record stdout and stderr with different tags in syslog?

I can redirect both stdout and stderr to logger this way: ./myprog 2>&1 | tee /dev/tty | logger but I would like to be able to tag each log entry with "myprog-out" and "myprog-err" based on ...
Sparkler's user avatar
  • 233
0 votes
3 answers
4k views

search in log from last hour

I need bash script to search in the log words Failed and failure. But only from last hour cut -c 5- /var/log/mail.log | awk '($0 >= from)' from="$(LC_TIME=C date +'%_d %H:%M:%S' -d -1hour)" |grep -...
myhell's user avatar
  • 1
1 vote
0 answers
498 views

Check to see if server is up

Create dir logs (for outputted logs) Create a script IsTheServerUp.bash Write a script to check if the server is up Log(echo) the outcome to the file Use curl command to check the server Use ...
CrazyGal's user avatar
2 votes
1 answer
411 views

Break and restart Linux command when specific text appears

To simplify the situation as much as possible, let's say I'm tailing a log file that gets rotated out when an application shutdown occurs. Since the file changes, the tail stops. In order to continue ...
mVChr's user avatar
  • 405
2 votes
1 answer
2k views

Recording a bash session

For auditing and documentation purposes, I'd like to find a command such that everything that happens in a given bash session, is written to a file. I.e., I'd like to end up with a file that shows ...
marc's user avatar
  • 163
8 votes
4 answers
29k views

Redirecting command output in docker

I want to do some simple logging for my server which is a small Flask app running in a Docker container. Here is the Dockerfile # Dockerfile FROM dreen/flask MAINTAINER dreen WORKDIR /srv # Get ...
Dreen's user avatar
  • 456
0 votes
3 answers
193 views

Check which string occurs first in a growing file

I'm running a remote executable which produces a logfile. I want to write a script to check whether the executable is run successfully or encounters an error. The way I can do this is by looking at ...
Eddy's user avatar
  • 3,397
0 votes
3 answers
295 views

Grep for block surrounding an error message

I want to grep for the block of logs around a particular error message. Say I know my log looks like this: [----] I, [2014-04-10T19:12:36.294512 #1910:e93004] INFO -- : Started GET "/ems_infra/new" ...
CHK's user avatar
  • 587
1 vote
1 answer
2k views

Logrotate append to existing file and truncate original

Is it possible with logrotate to take the content of a log and add it to an existing file? Like so: 1. Put the content of /var/log/vnc.log after the content of /archive/logs/vnc.log 2. Truncate /...
Sat's user avatar
  • 31
2 votes
3 answers
1k views

log execution of certain commands on linux

I have to maintain a system (debian) on which several users are allowed to install programs - so I would like to log, for example, if anyone executes "apt-get install" or "apt-get purge", so I can ...
user avatar
3 votes
2 answers
4k views

How to make `script` command loaded automatically on terminal login

script command allows to log gently everything that was put to console during session (like history but also displays results of commands). Everything is logged to file typescript.xxx Now I want to ...
dfens's user avatar
  • 141
2 votes
2 answers
127 views

Efficient environment for viewing logs [closed]

Currently I am using tail -f for viewing logs. Is there any more efficient/readable/better way of viewing logs?
Marcin Szymczak's user avatar

15 30 50 per page