Skip to content

Instantly share code, notes, and snippets.

View rfay's full-sized avatar

Randy Fay rfay

View GitHub Profile
curl -XGET http://util.archetypeme.com:9200/logstash-2013.07.23/_search?pretty -d'
{
"facets": {
"0": {
"date_histogram": {
"field": "@timestamp",
"interval": "30s"
},
"facet_filter": {
"fquery": {
{
"took" : 14,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 933840,
output {
stdout {
debug => true
}
elasticsearch {
cluster => "logstash"
}
}
grok {
tags => [ "Drupal" ]
match => [ "@message", "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_host} *drupal: *https?://%{HOSTNAME:drupal_vhost}\|(?<drupal_full_message>.*)" ]
}
csv {
tags => [ "Drupal" ]
separator => "|"
source => "@fields.drupal_full_message"
columns => [ "drupal_timestamp", "drupal_type", "drupal_client_ip", "drupal_request_uri", "drupal_referrer", "drupal_severity", "drupal_message" ]
SELECT CONCAT(table_schema, '.', table_name), CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, ROUND(index_length / data_length, 2) idxfrac FROM information_schema.TABLES WHERE table_schema = 'warmshowers' ORDER BY data_length + index_length DESC LIMIT 10;
+---------------------------------------+-------+-------+-------+------------+---------+
| CONCAT(table_schema, '.', table_name) | rows | DATA | idx | total_size | idxfrac |
+---------------------------------------+-------+-------+-------+------------+---------+
| warmshowers.search_index | 1.02M | 0.05G | 0.12G | 0.17G | 2.17 |
| warmshowers.queue | 0.02M | 0.12G | 0.00G | 0.12G | 0.01 |
| warmshowers.cache_form | 0.00M | 0.09G | 0.00G | 0.09G | 0.01 |
| warmsho
@rfay
rfay / gist:3503556
Created August 28, 2012 20:07
Mariadb "copying to tmp table" problem on Warmshowers.org - IRC conversation
Could anybody help me with a mariadb/mysql problem "Copying to tmp table" which happens only randomly on my server, but brings all database activities to a halt? I haven't been able to solve this over a couple of years now. https://github.com/rfay/Warmshowers.org/issues/22
[13:26] <montywi> rfay: looking
[13:26] <rfay> montywi, much appreciated
[13:26] <montywi> Which version was this
[13:27] <rfay> montywi, 5.1, Ubuntu 10.04, 5.1.49-mariadb82
[13:27] <montywi> The 'copying to tmp table' part is a LOT faster in MariaDB than a MySQL (I have seen > 10x speedup)
[13:28] <montywi> ok, the speedup is in > 5.1 I think. Checking...
[13:28] <rfay> It has been better since I upgraded to Mariadb. However, still brings all database-based websites to a halt
[13:28] <litheum> rfay: any opportunity to improve the queries that are cerating these tmp tables/files?
[13:29] <litheum> rfay: or locate tmpdir on a faster device? or increase max_heap_table_size and max_tmp_table_size if you are having a lot of temporary t
+/**
+ * Identify language from the Accept-language HTTP header we got.
+ * this is a simple copy from language_from_browser() in Drupal's language.inc.
+ * That one, unfortunately, discards any language that is not configured.
+ */
+function translatableregions_language_from_browser() {
+ // Specified by the user via the browser's Accept Language setting
+ // Samples: "hu, en-us;q=0.66, en;q=0.33", "hu,en-us;q=0.5"
+ $browser_langs = array();
+
@rfay
rfay / gist:2979841
Created June 23, 2012 20:34
Testbot 818 error log for http://drupal.org/node/1655158
[Sat Jun 23 19:45:04 2012] [error] [client 10.20.0.109] Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException: "" at /var/lib/drupaltestbot/sites/default/files/checkout/core/modules/comment/comment.pages.inc line 121
[Sat Jun 23 19:45:31 2012] [error] [client 10.20.0.109] Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException: "No route found for "GET /pagedoesnotexist"" at /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/EventSubscriber/RouterListener.php line 88
[Sat Jun 23 19:46:02 2012] [error] [client 10.20.0.109] Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException: "" at /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/EventSubscriber/AccessSubscriber.php line 34
[Sat Jun 23 19:46:02 2012] [error] [client 10.20.0.109] Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException: "" at /var/lib/drupaltestbot/sites/def
[Thu Jun 14 19:10:13 2012] [error] [client 50.16.161.56] Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException: "No route found for "GET /yBxNiJSaKM"" at /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/EventSubscriber/RouterListener.php line 88
[Thu Jun 14 19:10:14 2012] [error] [client 50.16.161.56] Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException: "No route found for "GET /sites/default/files/simpletest/192908/xn3FGf73/%D0%A4%D0%B0%D0%B9%D0%BB%20%D0%B4%D0%BB%D1%8F%20%D1%82%D0%B5%D1%81%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F%20xy7VviPC"" at /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/EventSubscriber/RouterListener.php line 88
[Thu Jun 14 19:10:45 2012] [error] [client 50.16.161.56] Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException: "No route found for "GET /taxonomy/term/1"" at /var/lib/drupaltestbot/sites/default/files/checkout/cor
[rfay@www2 htdocs]$ drush pdsd payment 7.x-1.x-dev
Array
(
[1090332] => Array
(
[uri] => currency
[version] => 7.x-1.0
[tag] => 7.x-1.0
)