Friday, July 31, 2015

Tail a file with current date

root@FR-121:/var/log/freeradius/radacct# cat detail
tail -f ./9.27.110.154/detail-$(date +"%Y%m%d") -f ./9.27.14.85/detail-$(date +"%Y%m%d") -f ./9.27.14.89/detail-$(date +"%Y%m%d") | grep -i -e "NAS-IP-Address" -e "Acct-Status-Type" -e "audit-session-id" -e "Acct-Session-Id" -e "Status" -e "Packets" -e "Terminate" -e "time"
root@FR-121:/var/log/freeradius/radacct#
root@FR-121:/var/log/freeradius/radacct#
root@FR-121:/var/log/freeradius/radacct# ./detail
        Acct-Session-Time = 493
        Acct-Terminate-Cause = Idle-Timeout
        Event-Timestamp = "Jul 31 2015 19:29:59 IST"
        Acct-Delay-Time = 0
        Timestamp = 1438330664
        Acct-Session-Time = 20
        Acct-Terminate-Cause = Session-Timeout
        Event-Timestamp = "Jul 31 2015 09:20:02 IST"
        Acct-Delay-Time = 0
        Timestamp = 1438342938
        Acct-Status-Type = Start
        Event-Timestamp = "Jul 31 2015 09:02:29 IST"
        Acct-Delay-Time = 0
        Timestamp = 1438342938
^Croot@FR-121:/var/log/freeradius/radacct#
root@FR-121:/var/log/freeradius/radacct#
root@FR-121:/var/log/freeradius/radacct#
root@FR-121:/var/log/freeradius/radacct# 

No comments:

Post a Comment