Incremental Text File Monitoring

In many situations it is desired to monitor a log file for errors in incremental fashion, as if tail -f was run on it, but in batches, say from a cron-scheduled task. The subject script takes the filename as an input and outputs what changed from the last invocation (storing the state in the same directory as a subject file).
The script (whatsnew.awk)
#!/bin/awk -f
# Copyright (C) 2012 Vladimir Lysyy


    FS=" ";

  if (NR == 1) {
    state_file = FILENAME ".lastline";
    sub(/^.*\//, "", state_file);
    getline last_line < state_file;
    print "state_file =", state_file, "last_line =", last_line

  if (NR <= last_line) next;

{ print; }

  print NR > state_file

Example invocation
$ whatsnew.awk /var/log/messages