example CouchDB views
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 18 Aug 2009 12:19:52 +0000 (12:19 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 18 Aug 2009 12:19:52 +0000 (12:19 +0000)
23 files changed:
couchdb/daemons/_id [new file with mode: 0644]
couchdb/daemons/_rev [new file with mode: 0644]
couchdb/daemons/language [new file with mode: 0644]
couchdb/daemons/views/stat/map.js [new file with mode: 0644]
couchdb/daemons/views/stat/reduce.js [new file with mode: 0644]
couchdb/pxelator/_id [new file with mode: 0644]
couchdb/pxelator/_rev [new file with mode: 0644]
couchdb/pxelator/language [new file with mode: 0644]
couchdb/pxelator/views/dhcp/map.js [new file with mode: 0644]
couchdb/pxelator/views/no-httpd/map.js [new file with mode: 0644]
couchdb/pxelator/views/syslog/map.js [new file with mode: 0644]
couchdb/syslog/_id [new file with mode: 0644]
couchdb/syslog/_rev [new file with mode: 0644]
couchdb/syslog/language [new file with mode: 0644]
couchdb/syslog/views/by_ip/map.js [new file with mode: 0644]
couchdb/syslog/views/by_ip/reduce.js [new file with mode: 0644]
couchdb/syslog/views/categories/map.js [new file with mode: 0644]
couchdb/syslog/views/categories/reduce.js [new file with mode: 0644]
couchdb/syslog/views/tag/map.js [new file with mode: 0644]
couchdb/syslog/views/tag/reduce.js [new file with mode: 0644]
couchdb/syslog/views/timeline-without-cron/map.js [new file with mode: 0644]
couchdb/syslog/views/timeline/map.js [new file with mode: 0644]
couchdb/syslog/views/vblade/map.js [new file with mode: 0644]

diff --git a/couchdb/daemons/_id b/couchdb/daemons/_id
new file mode 100644 (file)
index 0000000..aaf32c1
--- /dev/null
@@ -0,0 +1 @@
+_design/daemons
\ No newline at end of file
diff --git a/couchdb/daemons/_rev b/couchdb/daemons/_rev
new file mode 100644 (file)
index 0000000..e098426
--- /dev/null
@@ -0,0 +1 @@
+1-283478820
\ No newline at end of file
diff --git a/couchdb/daemons/language b/couchdb/daemons/language
new file mode 100644 (file)
index 0000000..f504a95
--- /dev/null
@@ -0,0 +1 @@
+javascript
\ No newline at end of file
diff --git a/couchdb/daemons/views/stat/map.js b/couchdb/daemons/views/stat/map.js
new file mode 100644 (file)
index 0000000..8e49b5e
--- /dev/null
@@ -0,0 +1,3 @@
+function(doc) {
+  emit(doc.package, 1);
+}
\ No newline at end of file
diff --git a/couchdb/daemons/views/stat/reduce.js b/couchdb/daemons/views/stat/reduce.js
new file mode 100644 (file)
index 0000000..3678496
--- /dev/null
@@ -0,0 +1,3 @@
+function(n, v) {
+  return sum(v);
+}
\ No newline at end of file
diff --git a/couchdb/pxelator/_id b/couchdb/pxelator/_id
new file mode 100644 (file)
index 0000000..324d21a
--- /dev/null
@@ -0,0 +1 @@
+_design/pxelator
\ No newline at end of file
diff --git a/couchdb/pxelator/_rev b/couchdb/pxelator/_rev
new file mode 100644 (file)
index 0000000..ed5cc4f
--- /dev/null
@@ -0,0 +1 @@
+3-724346140
\ No newline at end of file
diff --git a/couchdb/pxelator/language b/couchdb/pxelator/language
new file mode 100644 (file)
index 0000000..f504a95
--- /dev/null
@@ -0,0 +1 @@
+javascript
\ No newline at end of file
diff --git a/couchdb/pxelator/views/dhcp/map.js b/couchdb/pxelator/views/dhcp/map.js
new file mode 100644 (file)
index 0000000..5758328
--- /dev/null
@@ -0,0 +1,4 @@
+function(doc) {
+  if ( doc.package == 'dhcpd' )
+  emit(doc.time, doc);
+}
\ No newline at end of file
diff --git a/couchdb/pxelator/views/no-httpd/map.js b/couchdb/pxelator/views/no-httpd/map.js
new file mode 100644 (file)
index 0000000..66a000e
--- /dev/null
@@ -0,0 +1,4 @@
+function(doc) {
+  if ( doc.package != 'httpd' )
+  emit(null, doc);
+}
\ No newline at end of file
diff --git a/couchdb/pxelator/views/syslog/map.js b/couchdb/pxelator/views/syslog/map.js
new file mode 100644 (file)
index 0000000..d511e37
--- /dev/null
@@ -0,0 +1,4 @@
+function(doc) {
+  if ( doc.package == 'syslogd' )
+  emit(doc.time, doc);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/_id b/couchdb/syslog/_id
new file mode 100644 (file)
index 0000000..1bcb5e3
--- /dev/null
@@ -0,0 +1 @@
+_design/syslog
\ No newline at end of file
diff --git a/couchdb/syslog/_rev b/couchdb/syslog/_rev
new file mode 100644 (file)
index 0000000..16240b4
--- /dev/null
@@ -0,0 +1 @@
+9-580338323
\ No newline at end of file
diff --git a/couchdb/syslog/language b/couchdb/syslog/language
new file mode 100644 (file)
index 0000000..f504a95
--- /dev/null
@@ -0,0 +1 @@
+javascript
\ No newline at end of file
diff --git a/couchdb/syslog/views/by_ip/map.js b/couchdb/syslog/views/by_ip/map.js
new file mode 100644 (file)
index 0000000..6dc24ce
--- /dev/null
@@ -0,0 +1,4 @@
+function(doc) {
+  if ( doc.package == 'syslogd' )
+  emit(doc.ip, 1);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/views/by_ip/reduce.js b/couchdb/syslog/views/by_ip/reduce.js
new file mode 100644 (file)
index 0000000..ee6c7f0
--- /dev/null
@@ -0,0 +1,3 @@
+function(k,v) {
+ return sum(v);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/views/categories/map.js b/couchdb/syslog/views/categories/map.js
new file mode 100644 (file)
index 0000000..5f5118e
--- /dev/null
@@ -0,0 +1,4 @@
+function(doc) {
+  if ( doc.package == 'syslogd' )
+  emit(doc.category, 1);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/views/categories/reduce.js b/couchdb/syslog/views/categories/reduce.js
new file mode 100644 (file)
index 0000000..ee6c7f0
--- /dev/null
@@ -0,0 +1,3 @@
+function(k,v) {
+ return sum(v);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/views/tag/map.js b/couchdb/syslog/views/tag/map.js
new file mode 100644 (file)
index 0000000..55c7ece
--- /dev/null
@@ -0,0 +1,4 @@
+function(doc) {
+  if ( doc.package == 'syslogd' )
+  emit(doc.tag, 1);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/views/tag/reduce.js b/couchdb/syslog/views/tag/reduce.js
new file mode 100644 (file)
index 0000000..ee6c7f0
--- /dev/null
@@ -0,0 +1,3 @@
+function(k,v) {
+ return sum(v);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/views/timeline-without-cron/map.js b/couchdb/syslog/views/timeline-without-cron/map.js
new file mode 100644 (file)
index 0000000..08f8b0c
--- /dev/null
@@ -0,0 +1,8 @@
+function(doc) {
+  if (
+   doc.package == 'syslogd'
+   && doc.tag != 'CRON'
+   && doc.tag != '/USR/SBIN/CRON'
+  )
+  emit([doc.timestamp,doc.tag], doc.message);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/views/timeline/map.js b/couchdb/syslog/views/timeline/map.js
new file mode 100644 (file)
index 0000000..d511e37
--- /dev/null
@@ -0,0 +1,4 @@
+function(doc) {
+  if ( doc.package == 'syslogd' )
+  emit(doc.time, doc);
+}
\ No newline at end of file
diff --git a/couchdb/syslog/views/vblade/map.js b/couchdb/syslog/views/vblade/map.js
new file mode 100644 (file)
index 0000000..4b25678
--- /dev/null
@@ -0,0 +1,4 @@
+function(doc) {
+  if ( doc.package == 'syslogd' && doc.tag == 'vbladed' )
+  emit([ doc.time, doc.timestamp ], [ doc.ip, doc.message ]);
+}
\ No newline at end of file