Skip to content

Instantly share code, notes, and snippets.

@ferryzhou
Last active August 29, 2015 14:08
Show Gist options
  • Save ferryzhou/79fcf69f558a531f2b72 to your computer and use it in GitHub Desktop.
Save ferryzhou/79fcf69f558a531f2b72 to your computer and use it in GitHub Desktop.
get github watch events in a month
curl -XPUT 'http://localhost:9200/_template/github-watch' -d @github-watch-mappings.json
{
"template": "github-watch-*",
"mappings": {
"logs": {
"properties": {
"repo_url": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}
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;
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