Skip to content

Instantly share code, notes, and snippets.

View toru-takahashi's full-sized avatar
🏠
Working from home

Toru Takahashi toru-takahashi

🏠
Working from home
View GitHub Profile
@toru-takahashi
toru-takahashi / td-monitor-agent.txt
Last active January 1, 2016 05:29
For Blog, td-monitor-agent
# add /etc/td-agent/td-agent.conf
<source>
type td_monitor_agent
apikey <TD_API_KEY>
instance_id <YOUR_INSTANCE_ID>
</source>
# dummy_log_generator.conf
configure 'sample' do
output "/var/log/dummy.log"
rate 50
delimiter ","
labeled false
field :id, type: :integer, countup: true, format: "%04d"
field :time, type: :datetime, format: "%Y-%m-%d %H:%M:%S", random: false
field :level, type: :string, any: %w[DEBUG INFO WARN ERROR]
end
# dummy.logを取得するfluentdの設定
<source>
type tail
path /var/log/dummy.log
pos_file /var/log/td-agent/dummy.log.pos
tag td.dummy.log
format csv
keys id,time,level
time_key time
time_format %Y-%m-%d %H:%M:%S
# 転送受け
<source>
type forward
port 24224
bind 0.0.0.0
</source>
# データチェックのためにTreasureDataに転送されてきたデータを送信
<match td.*.*>
type tdlog
# Modify /etc/init.d/monit.conf
set httpd port 2812 and
allow admin:monit # require user 'admin' with password 'monit'
check process tdagent with pidfile "/var/run/td-agent/td-agent.pid"
start program = "/etc/init.d/td-agent start"
stop program = "/etc/init.d/td-agent stop"
if 5 restarts within 5 cycles then timeout
var Bleacon = require('bleacon');
Bleacon.startScanning();
var logger = require('fluent-logger');
logger.configure('td.ibeacon_db', {host: 'localhost', port: 24224});
Bleacon.on('discover', function(bleacon) {
console.log(bleacon);
logger.emit('ibeacon_table', {
uuid: bleacon.uuid,

To not be able to use uppercase-letters in column names for schema settings to the table.

Schemas currently support column names consisting of lowercase alphabets, numbers, and "_" only. http://docs.treasuredata.com/articles/schema#setting-custom-schema

If you used uppercase-letters for column name, you need to re-import to table now.

We provide a way to re-import to table.

  • To get column names.
in:
type: zendesk
login_url: https://<YOUR_DOMAIN_NAME>.zendesk.com
auth_method: token # Your Zendesk auth method
username: <YOUR_EMAIL_ADDRESS> # Your Zendesk Login Email Address
token: <YOUR_API_TOKEN> # Your Zendesk API Token
target: tickets # Zendesk Object to import
start_time: "2007-01-01 00:00:00+0000"
out:
mode: append
-- Hive --
SELECT
user,
TD_FIRST(category, node_id) AS landing_category,
TD_LAST (category, node_id) AS last_category,
COLLECT_ALL( category ) AS category_set,
TD_FIRST(page_id, node_id) AS landing_node,
TD_LAST (page_id, node_id) AS last_node,
COLLECT_ALL( page_id ) AS node_set,