6
nitwhiz
6y

How the fuck do you actually tail log files?

Like i want the whole log. Not only from today, not *.log.1 and *.log, i want to run the *whole* log ever done, even the gzipped shit, through tail | grep.

Comments
  • 4
    Then why would you use tail instead idk, cat? Tail is really just to show the end of the file.
  • 1
    @gathurian i'm using tail to follow the whole thing live. cat would do the job, too, but how to view a concatenated output of all the .log, .log.1,2,3,... and .log.gz, .log.gz.1,2,3,... files?
  • 3
    Haven't used it, but heard of multitail.

    If your problem is more like following the files through log rotation consider just using '-F' option.
  • 1
    @nitwhiz If you want to follow it, why would you want to see the wgole damn file? Do I understand rhis correctly that you want a live updated log on the standard output/terminal? Like tail -f but instead of the last 20 lines it's the whole file?
  • 0
    @gathurian you can tell tail to output the whole file before following, you know that?
    I want the whole log ever happened. Through log rotation you get a few log files and a few gz ones. I hoped for an easy way to actually read these 4 different kinds of file name patterns in one go, ordered by their timestamps.

    @phorkyas gotta look into that.
  • 1
    How about:
    tail -f -n +1 some.log
  • 1
    Srsly, whats the point to dump all the history to stdout if you only need to tail? It's not like you're gonna read those first 180mln lines...
  • 2
    How does one *actually* tails a file? One runs ´tail <file>´ or ´tail -F <file>´
  • 0
    @Commodore did that to print the whole file.

    @netikras i want to grep the whole apache access log for something specific. After 2 weeks of runtime and low access counts that's actually not much in those files, the grepped result is going to be a few lines.
  • 1
    @nitwhiz
    grep != tail

    zegrep -RHn "my_pattern" rotated_logs.gz*
    egrep -RHn "my_pattern" live_logs*

    sometimes zegrep recognizes non-gzipped files as well
  • 0
    @netikras i piped tail into grep. So i can see live results, grepped.

    Thanks for your answer though.
Add Comment