Skip to content

Instantly share code, notes, and snippets.

View gswallow's full-sized avatar

Greg Swallow gswallow

  • Indianapolis, IN, USA
View GitHub Profile
Generated at 2013-12-06 14:35:45 -0500
Chef::Exceptions::Win32APIError: file[c:/packages/xcalibur/Xcalibur+2.2+Foundation+2.zip] (c:/chef/cache/cookbooks/s3_file/providers/default.rb line 64) had an error: Chef::Exceptions::Win32APIError: The operation completed successfully.
---- Begin Win32 API output ----
System Error Code: 0
System Error Message: The operation completed successfully.
---- End Win32 API output ----
input {
stdin {
type => "rails"
codec => multiline {
pattern => "(^I, \[%{TIMESTAMP_ISO8601} #%{NONNEGINT}\]\s+%{LOGLEVEL}\s--\s:\s{1,2}(Started|Completed|Processing|Parameters)|E, \[%{{TIMESTAMP_ISO8601} #%{NONNEGINT}\]\s+%{LOGLEVEL}\s--|^\s{2,}/)"
what => "previous"
}
}
}
output {
One event shows up as one event
I, [2014-01-10T14:37:19.034362 #30935] INFO -- : Started GET "/assay_configurations/52cc92a82f52768fac0007ad/qa_rules/52d00c39e4b07d43957208f5" for 207.250.246.98 at 2014-01-10 14:37:19 -0500
I, [2014-01-10T14:37:19.037855 #30935] INFO -- : Processing by QaRulesController#read as JSON
I, [2014-01-10T14:37:19.037926 #30935] INFO -- : Parameters: {"assay_id"=>"52cc92a82f52768fac0007ad", "qa_rule_id"=>"52d00c39e4b07d43957208f5"}
I, [2014-01-10T14:37:19.061787 #30935] INFO -- : Completed 200 OK in 24ms (Views: 2.7ms)
Multiple events also show up as one event
I, [2014-01-10T14:37:19.034362 #30935] INFO -- : Started GET "/assay_configurations/52cc92a82f52768fac0007ad/qa_rules/52d00c39e4b07d43957208f5" for 207.250.246.98 at 2014-01-10 14:37:19 -0500
#!/bin/sh
cd /usr/local/share/mms-agent/mms-agent
exec 2>&1
exec chpst -u root:root python /usr/local/share/mms-agent/mms-agent/agent.py 2>&1
In a ruby block I try to create a template:
def create_runcontext
@events = Chef::EventDispatch::Dispatcher.new
# Load the ascent-compute cookbook.
cb_list = Chef::CookbookLoader.new(Chef::Config[:cookbook_path])
cb_list.load_cookbook("ascent-compute")
# Create a cookbook collection object for use later, in a run context
ruby_block "Comb through assays and create templates" do
block do
def find_assays(customer)
assays = Array.new
assays_dir = Dir.entries("/var/scripts/assays/#{customer}/current")
assays_dir.each { |e| assays << e unless e =~ /^\./ }
assays
end
# This file was created for hk01.qa1.indigobio.com
# by Chef
# Manual changes will be lost
input {
file {
'codec' => multiline {
'pattern' => "^[EI], \["
'negate' => "true"
'what' => "previous"
node.default['mongodb']['logstash_server_role'] = "logstash_allinone"
logstash_server = search(:node, "role:#{node['mongodb']['logstash_server_role']} AND chef_environment:#{node.chef_environment}").first
unless logstash_server.nil?
node.set['logstash']['patterns'] = {
"mongodb" => {
"WORDDASH" => '\b[\w-]+\b',
"MONGODB" => '%{SYSLOGTIMESTAMP:timestamp} \[%{WORD:component}\] %{GREEDYDATA:message}',
"SLOW_QUERY" => 'query %{WORDDASH:database}\.%{WORDDASH:collection} %{NOTSPACE}: \{ (?<query>(.*)(?<=(} )))%{WORD}:%{NONNEGINT:ntoreturn} %{WORD}:%{NONNEGINT:ntoskip} %{WORD}:%{NONNEGINT:nscanned} %{NOTSPACE:what}..*(?<duration>(?<= )[0-9]+)ms'
}
@gswallow
gswallow / gist:9011322
Last active August 29, 2015 13:56
grok patterns for mongodb logs
WORDDASH \b[\w-]+\b
QUERY \{ (?<={ ).*(?= } ntoreturn:) \}
MONGODB %{SYSLOGTIMESTAMP:timestamp} \[%{WORD:component}\] %{GREEDYDATA:message}
After extracting [message] using %{MONGODB}, pass [message] through grok once again using %{SLOWQUERY}
SLOWQUERY %{WORD} %{WORDDASH:database}\.%{WORDDASH:collection} %{WORD}: %{QUERY:query} %{WORD}:%{NONNEGINT:ntoreturn} %{WORD}:%{NONNEGINT:ntoskip} %{WORD}:%{NONNEGINT:nscanned}.*nreturned:%{NONNEGINT:nreturned}..+ (?<duration>[0-9]+)ms
query ascent_production_alere1.assay_configurations query: { converted_chromatogram_id: { $in: [ ObjectId('b1cbbf5ce3ab610d74830642') ] } } ntoreturn:1 ntoskip:0 nscanned:1 keyUpdates:0 locks(micros) r:268396 nreturned:1 reslen:1926148 268ms
"post-processors": [
{
"type": "vagrant",
"output": "{{.BuildName}}.box",
"only": [ "indigo_windows-2008r2-sp1-amd64-vmware", "indigo_windows-2008r2-sp1-amd64-virtualbox" ],
"keep_input_artifact": true,
"vagrantfile_template": "vmware/Vagrantfile.tmpl",
"override": {
"indigo_windows-2008r2-sp1-amd64-virtualbox": {
"vagrantfile_template": "virtualbox/Vagrantfile.tmpl"