Monday, 30 November 2015

Get list of all files in a directory whose size is greater then 20MB

find <directory-path> -type f -size +20000k -exec ls -lh {} \; 2> /dev/null | awk '{ print $NF ": " $5 }'

Friday, 27 November 2015

Get List of all user agents

cat /var/log/access-log-file.log | awk -F'"' '{print $6}' | sort | uniq -c | sort -rn | head -n20000 > /home/output-file-path.txt

If log is in gz format
zcat /var/log/access-log-file.log | awk -F'"' '{print $6}' | sort | uniq -c | sort -rn | head -n20000 > /home/output-file-path.txt

Tuesday, 3 November 2015

Start logstash

Logstash agent (forwarder)
/usr/local/logstash/bin/logstash -f /etc/logstash/agent.conf agent &

Logstash
/usr/local/logstash/bin/logstash -f /etc/logstash.conf