Display log files in reverse order

Discussion in 'General' started by adamjedgar, Sep 12, 2017.

  1. adamjedgar

    adamjedgar Member

    Just wondering how i get log files (for fail2ban and system) inside ispconfig monitor to display in reverse order?
     
  2. Pasqui Andrea

    Pasqui Andrea New Member

    Did you try to use this?
    Code:
    tail -r /path/to/log/file.log
     
  3. adamjedgar

    adamjedgar Member

    tail: invalid option -- 'r'
    Try 'tail --help' for more information

    I dont see the '-r' option in tail?

    Mandatory arguments to long options are mandatory for short options too.
    -c, --bytes=K output the last K bytes; or use -c +K to output
    bytes starting with the Kth of each file
    -f, --follow[={name|descriptor}]
    output appended data as the file grows;
    an absent option argument means 'descriptor'
    -F same as --follow=name --retry
    -n, --lines=K output the last K lines, instead of the last 10;
    or use -n +K to output starting with the Kth
    --max-unchanged-stats=N
    with --follow=name, reopen a FILE which has not
    changed size after N (default 5) iterations
    to see if it has been unlinked or renamed
    (this is the usual case of rotated log files);
    with inotify, this option is rarely useful
    --pid=PID with -f, terminate after process ID, PID dies
    -q, --quiet, --silent never output headers giving file names
    --retry keep trying to open a file if it is inaccessible
    -s, --sleep-interval=N with -f, sleep for approximately N seconds
    (default 1.0) between iterations;
    with inotify and --pid=P, check process P at
    least once every N seconds
    -v, --verbose always output headers giving file names
    --help display this help and exit
    --version output version information and exit
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    tail /var/loga/file.log | tac
     
  5. adamjedgar

    adamjedgar Member

    what does 'tac' stand for?
    also, is it a good idea to reverse order the log files? I worry i might be setting in motion a bad habit in looking at most recent logs first? (i just dont want to scroll down and down and down to find most recent entry)
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    tac command = cat in reverse.
     
  7. adamjedgar

    adamjedgar Member

    Omg...so simple i missed it :oops:
     

Share This Page