Last active
August 29, 2015 14:08
-
-
Save ferryzhou/79fcf69f558a531f2b72 to your computer and use it in GitHub Desktop.
get github watch events in a month
This file contains 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
curl -XPUT 'http://localhost:9200/_template/github-watch' -d @github-watch-mappings.json |
This file contains 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
{ | |
"template": "github-watch-*", | |
"mappings": { | |
"logs": { | |
"properties": { | |
"repo_url": { | |
"type": "string", | |
"fields": { | |
"raw": { | |
"type": "string", | |
"index": "not_analyzed" | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains 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
select repository_url, actor, created_at | |
from [githubarchive:github.timeline] | |
where type="WatchEvent" and created_at >= '2014-08-01 00:00:00' and created_at < '2014-09-01 00:00:00' | |
group each by repository_url, actor, created_at | |
order by created_at desc; |
This file contains 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
input { | |
file { | |
path => [ "/home/jinzhou/Downloads/2014_08_repourl_actor_createdat.csv" ] | |
} | |
} | |
filter { | |
csv { | |
columns => ["repo_url", "actor", "datetime" ] | |
} | |
date { | |
locale => "en" | |
match => [ "datetime", "yyyy-MM-dd HH:mm:ss" ] | |
timezone => "UTC" | |
} | |
} | |
output { | |
#stdout { codec => rubydebug } | |
elasticsearch { | |
host => localhost | |
index => "github-watch-%{+YYYY.MM.dd}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment