Last active
August 29, 2015 13:58
-
-
Save takkyuuplayer/9968466 to your computer and use it in GitHub Desktop.
access_log_watch.pl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192.168.100.1 - - [04/Apr/2014:02:53:09 +0000] "GET / HTTP/1.1" 200 11 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36" | |
192.168.100.1 - - [04/Apr/2014:02:53:15 +0000] "GET / HTTP/1.1" 200 11 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192.168.100.1 - - [04/Apr/2014:02:53:09 +0000] "GET / HTTP/1.1" 200 11 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36" | |
192.168.100.1 - - [04/Apr/2014:02:53:15 +0000] "GET / HTTP/1.1" 200 11 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36" | |
192.168.100.1 - - [04/Apr/2014:04:50:37 +0000] "GET / HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use JSON qw(encode_json); | |
my $dir = $ARGV[0]; | |
my $errors = `cat $dir/* | awk '{print \$9, \$0}' | grep '^5' | tail`; | |
exit 1 if $errors eq ''; | |
my $url = 'https://$TEAMNAME.slack.com/services/hooks/incoming-webhook?token=$TOKEN'; | |
my $payload = { | |
"channel" => "#alert", | |
"text" => $errors, | |
}; | |
system 'curl', '-X', 'POST', '--data', sprintf("payload=%s", encode_json($payload)), $url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php echo 'Hello World'; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php echa 'Hello World'; # typo ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment