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
classOf[sun.management.snmp.jvmmib.JVM_MANAGEMENT_MIBOidTable].getDeclaredField("varList") match { case f:java.lang.reflect.Field => f.setAccessible(true); f.get(null).asInstanceOf[Array[com.sun.jmx.snmp.SnmpOidRecord]].foreach(s => println(s.getName + "\t" + s.getOid))} |
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
#!/bin/sh | |
VERSION=0.11.0 | |
URL=http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/0.11.0/sbt-launch.jar | |
PWD=`cd .;pwd` | |
SCRIPT=${PWD}/sbt-${VERSION} | |
wget "$URL" -O ${PWD}/sbt-launch-${VERSION}.jar | |
echo "#!/bin/sh | |
JAR=${PWD}/sbt-launch-${VERSION}.jar | |
if [ -z \"\$JAVA_HOME\" ]; then |
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
module Fluent | |
class KestrelOutput < BufferedOutput | |
Fluent::Plugin.register_output('kestrel', self) | |
attr_reader :hosts, :kestrel | |
def initialize | |
super | |
require 'msgpack' | |
require 'kestrel' | |
end |
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
<source> | |
type tail | |
path path_to_file1 | |
pos_file path_to_pos_file1 | |
tag app.file1 | |
format /^(?<ip>[^ ]+) [^ ]+ [^ ]+ \[(?<time>[^\]]+)\] "(?<method>\S+) /(?<country>[A-Z0-9]{0,3})_(?<domain>[^/]+)/(?<module>[^/]+)/(?<controller>[^/]+)/(?<action>[^/]+)/(?<record>\S*)" (?<code>\d+) (?<res_time>\d+) "(?<referer>[^\"]*)" "(?<old_device>[^_\" ]*)_(?<device>[^_\" ]*)_(?<browser>[^_\" ]*) ?(?<guid>[^\"]*)" "(?<vuid>\d*) ?(?<option>[^\"]*)"$/ | |
time_format %d/%b/%Y:%H:%M:%S %z | |
rotate_wait = 5s | |
</source> |
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
class Fluent::SplitterOutput < Fluent::Output | |
Fluent::Plugin.register_output('splitter', self) | |
PATTERN_MAX_NUM = 20 | |
(1..PATTERN_MAX_NUM).each do |i| | |
config_param ('pattern' + i.to_s).to_sym, :string, :default => nil | |
end | |
config_param :preserve_tag, :bool, :default => false |
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
<!-- Gist CSS --> | |
<style type="text/css" media="screen"> | |
.gist{ | |
margin: 15px 0 !important; | |
} | |
.gist-file{ | |
border: none !important; | |
} | |
.gist-meta{ |
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
private[worker] case class QueueMonitor(processor: Processor) extends Actor with Logger { | |
private[this] val BLOCK_TIME = Some(1000L) | |
def act { | |
loop { | |
{ | |
reactWithin(1000) { | |
case Take => | |
// blocking dequeue | |
processor.queue.dequeue(BLOCK_TIME) map { message => |
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
@SuppressWarnings("unchecked") | |
public static <T> T get(Object key) throws IllegalArgumentException { | |
return (T) delegate().get(key); | |
} |
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
private void fetchAndWriteLog(LogQuery query, String fileName) throws Exception { | |
FileService fs = FileServiceFactory.getFileService(); | |
AppEngineFile file = null; | |
FileWriteChannel channel = null; | |
Writer writer = null; | |
try { | |
long start = System.currentTimeMillis(); | |
file = fs.createNewGSFile(new GSFileOptionsBuilder() | |
.setBucket(GS_BUCKET_NAME) |
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
oauth2_refresh_token = JSON.parse(`cat ~/.appcfg_oauth2_tokens`)["refresh_token"] | |
`#{$APPCFG} request_logs --oauth2 --noauth_local_webserver --oauth2_refresh_token=#{oauth2_refresh_token} --severity=1 --num_days=2 --end_date=#{TARGET_DATE_NAME} #{$SRC_DIR} #{LOG_TMP_DIR}/request.log` | |
`grep -s "^ [0-9]\\+:[0-9]\\+\\.[0-9]\\+ #{PREFIX_OF_ACTIVITY_LOG} \\(#{TARGET_DATE_PLUS1_NAME} 0[0-3]\\|#{TARGET_DATE_NAME} \\(0[4-9]\\|1[0-9]\\|2[0-3]\\)\\)" #{LOG_TMP_DIR}/request.log | sed "s/^ [0-9]\\+:[0-9]\\+\\.[0-9]\\+ #{PREFIX_OF_ACTIVITY_LOG} //" > #{LOG_FILE}` | |
GS_DIR = "gs://backetname/activity-log" | |
`#{$GSUTIL} cp #{LOG_FILE} #{GS_DIR}/#{TARGET_DATE_YMD}` |
OlderNewer