<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to SampleFiles</title><link>https://sourceforge.net/p/dbd2/wiki/SampleFiles/</link><description>Recent changes to SampleFiles</description><atom:link href="https://sourceforge.net/p/dbd2/wiki/SampleFiles/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 01 Jan 2021 09:17:49 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/dbd2/wiki/SampleFiles/feed" rel="self" type="application/rss+xml"/><item><title>SampleFiles modified by Ed Freesmeyer</title><link>https://sourceforge.net/p/dbd2/wiki/SampleFiles/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -10,6 +10,8 @@
             &lt;a href="#Config1"&gt;A Simple (non-syslog) Configuration File&lt;/a&gt;
         
             &lt;a href="#Config2"&gt;A Configuration File With Syslog Support&lt;/a&gt;
+        
+            &lt;a href="#CacheFile"&gt;A Name-Cache File&lt;/a&gt;
         
     
 
@@ -98,21 +100,20 @@
 &lt;a href="#top"&gt;Return to top&lt;/a&gt;

 &lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
-
 &lt;/p&gt;&lt;pre style="font-family: Arial; line-height: 20px; color: #00008f;"&gt; stderr = /Users/ed/Documents/C Projects/nms/dbd/test/derr, uid=ed, gid=staff, mode=666, level = 7
 logfile = /Users/ed/Documents/C Projects/nms/dbd/test/dout, uid=ed,gid=staff,level=7,mode=666

 # Config file for dbd (database dump) program. '#' in column 1 is a comment
 # All Global settings go above the database-definition blocks
-# [&amp;lt;block-name&amp;gt;]
-# id=# -&amp;gt; must be a postive (non-negative) integer
-# host=&amp;lt;hostname&amp;gt;
-# database=&amp;lt;database-name&amp;gt;
-# port=&amp;lt;port-spec&amp;gt; # where &amp;lt;port-spec&amp;gt; can be file-pathname, host.port,v=46 as per syslogd2
+# [&amp;lt;block-name&amp;gt;]
+# id=# -&amp;gt; must be a postive (non-negative) integer
+# host=&amp;lt;hostname&amp;gt;
+# database=&amp;lt;database-name&amp;gt;
+# port=&amp;lt;port-spec&amp;gt; # where &amp;lt;port-spec&amp;gt; can be file-pathname, host.port,v=46 as per syslogd2
 # type=(mysql)
-# username=&amp;lt;username&amp;gt;
-# password=&amp;lt;password&amp;gt;
+# username=&amp;lt;username&amp;gt;
+# password=&amp;lt;password&amp;gt;

 defaults = inputfieldcount 8, globalmsgcount   500
 # defaults = templatenames = temp;t
@@ -166,11 +167,11 @@
 #      The 't[n]' lines are the actual template commands (unique to each database type) that accomplish each command.
 #
 #      In this sample database, the 'start_time' and 'end_time' are the date/time the jobs start and end or when the db_client app was launched to record each start/end
-#          the 'log_start_time' and 'log_end_time' fields are the actual database logging times.  the (log_*_time - *_time) values are the # seconds it took for the message to be
+#          the 'log_start_time' and 'log_end_time' fields are the actual database logging times.  the (log_*_time - *_time) values are the # seconds it took for the message to be
 #          transmitted from the cluster client to the database table.

 # The format for a dynamic variable definition is:
-#  '$' [=] &amp;lt;column 1=""&amp;gt; [=] &amp;lt;column (a="" list)="" 2="" comma-separated=""&amp;gt; [=] &amp;lt;column of="" list="" 3="" variable-names)="" omma-separated="" (a=""&amp;gt;
+#  '$' [=] &amp;lt;Column 1&amp;gt; [=] &amp;lt;Column 2 (A comma-separated list)&amp;gt; [=] &amp;lt;Column 3 (A omma-separated list of variable-names)&amp;gt;
 #
 # System Variable Name Definitions
 # Column 1: select a 'field' or 'category' to operate on.
@@ -231,7 +232,7 @@
 #              'ipv6' : display IPv6 address if available, regardless of whether message was received via IPv4 or IPv6.
 #          Failure to specify an IP family will invoke the global "IPPreference" value of either '4' or '6 to determine which IP Address-family to display if both are available.
 #
-#      Column 1 is 'facpri': default is to display either the combined numeric value or "&amp;lt;facility-name&amp;gt;.&amp;lt;priority-name&amp;gt;" as a string value.
+#      Column 1 is 'facpri': default is to display either the combined numeric value or "&amp;lt;facility-name&amp;gt;.&amp;lt;priority-name&amp;gt;" as a string value.
 #          'nofacility', 'nofac' : suppress the facility portion of either the number or the string.
 #          'nopriority', 'nopri' : suppores the priority portion of either the number or the string. Numeric facilities will range from 0 ('kern') to 23 ('local7') or higher for 'extra' facilities.
 #
@@ -315,7 +316,7 @@
 $ rawinput = source,raw = rawinput

 # one entry per logical line -- numeric range is positive integers.
-# incoming data is "name = value",  sql uses $&amp;lt;sql-index&amp;gt; to access &amp;lt;value&amp;gt;
+# incoming data is "name = value",  sql uses $&amp;lt;sql-index&amp;gt; to access &amp;lt;value&amp;gt;
 # ************************************************************************************************************
 # C A U T I O N:  If the user-defined sql-index numbers are NOT sequential, processing will fail because:
 #      NULL ptrs in the SQL2VarArray will cause premature end-of-loop
@@ -328,20 +329,20 @@
 #
 # To access raw syslog fields, define &amp;amp; assign dynamic variables with source='syslog', options= "rawinpug"
 # The format for a variable definition is:
-#  'var' [=] &amp;lt;numeric sql-index=""&amp;gt; [=] &amp;lt;comma-separated variable="" of="" list="" names=""&amp;gt;
+#  'var' [=] &amp;lt;numeric sql-index&amp;gt; [=] &amp;lt;comma-separated list of variable names&amp;gt;
 #
 # To access and use a dynamic-variable definition, prepend a '$' to the dynamic-variable name(s) when specifying the name-list in (column 3).
-# The &amp;lt;sql-index&amp;gt; field (column 2) is preceded by a '$' in the template field to access the contents of that variable.
+# The &amp;lt;sql-index&amp;gt; field (column 2) is preceded by a '$' in the template field to access the contents of that variable.
 #
 #          if template string 1 in database z is: "insert into jobs fields (owner,jobid,start_time) values ('$14', $3, '$9');"
 #  and an input string of -t=z1 "user=Tom Jones, start_time=`date \"+%s\"`, job = 156"   will result in the following query string being sent to the database:
-#          insert into jobs fields (owner,jobid,start_time) values ('Tome Jones', 156, '&amp;lt;date format="" numeric="" in=""&amp;gt;');
-#
-# The names in column 3 are used to match against incoming &amp;lt;name =="" value=""&amp;gt; pairs in incoming data strings.
+#          insert into jobs fields (owner,jobid,start_time) values ('Tome Jones', 156, '&amp;lt;date in numeric format&amp;gt;');
+#
+# The names in column 3 are used to match against incoming &amp;lt;name = value&amp;gt; pairs in incoming data strings.
 #
 # To process syslog messages, the selector-string + template key is defined separately.
 # The selector-string is matched against the message facility+priority values in the message to obtain a template key-string.
-# A dynamic definition of &amp;lt;field&amp;gt;+"syslog+raw" will access the raw syslog data field components. Other options will provide customized formatting for the contents of those field.
+# A dynamic definition of &amp;lt;field&amp;gt;+"syslog+raw" will access the raw syslog data field components. Other options will provide customized formatting for the contents of those field.
 #

 var 14=username, user, uid, owner,o
@@ -465,13 +466,15 @@
 file=/Users/ed/Documents/C Projects/nms/dbd/test/outputFile_z,uid=ed,gid=staff,mode=666 #,filter=demo filter, spoolfilemax=4g,spoolfile, sfa= 1,connections=4
 enable = syslog,logfile
 logfile=/Users/ed/Documents/C Projects/nms/dbd/test/z.log, uid=ed,gid=staff,mode=666,level=3
- template 1 insert into jobs (rawinput, dbdate, jobid,server_fqdn,server_host,source_fqdn,servertime,end_time,start_time,time,member,sourcehost,sourceip,owner) values ('$1','$2','$3','$4','$5','$6','$7','$8','$9','$10','$11','$12','$13','$14', '$15', [$54]);
+ template 1 insert into jobs (rawinput, dbdate, jobid,server_fqdn,server_host,source_fqdn,servertime,end_time,start_time,time,member,sourcehost,sourceip,owner) values  \
+ ('$1','$2','$3','$4','$5','$6','$7','$8','$9','$10','$11','$12','$13','$14', '$15', [$54]);
  template 3 insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$2','$1','$9','$4','$5','$13','$12','$11');
  template 2 update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';
 template 10 Raw Syslog template: '$50','$51','$52','$53','$54'    '$1'
 template 11 Facpri Test: [$30] [$31] [$32] [$33] [$34]          [$35] [$36] [$37] [$38] [$39]
 template 12 Time Test: [$40] [$41] [$42] [$43] [$44]          [$45] [$46] [$47] [$48] [$49]
-template 13 Host Test: [$100] [$101] [$102] [$103] [$104]     [$105] [$106] [$107] [$108] [$109]  -&amp;gt;  [$110] [$111] [$112] [$113] [$114]     [$115] [$116] [$117] [$118] [$119]  -&amp;gt;   [$120] [$121] [$122] [$123] [$124]     [$125] [$126] [$127] [$128] [$129]
+template 13 Host Test: [$100] [$101] [$102] [$103] [$104]     [$105] [$106] [$107] [$108] [$109]  -&amp;gt;  [$110] [$111] [$112] [$113] [$114]     [$115] [$116] [$117] [$118] [$119]  -&amp;gt;  \
+[$120] [$121] [$122] [$123] [$124]     [$125] [$126] [$127] [$128] [$129]
 # -----------------------------------------------------------------------------------------------
 [testdb1] destid = r, type = mysql
 #
@@ -545,3 +548,40 @@
 &amp;lt;/field&amp;gt;&amp;lt;/name&amp;gt;&amp;lt;/date&amp;gt;&amp;lt;/sql-index&amp;gt;&amp;lt;/comma-separated&amp;gt;&amp;lt;/numeric&amp;gt;&amp;lt;/value&amp;gt;&amp;lt;/sql-index&amp;gt;&amp;lt;/priority-name&amp;gt;&amp;lt;/facility-name&amp;gt;&amp;lt;/column&amp;gt;&amp;lt;/column&amp;gt;&amp;lt;/column&amp;gt;&amp;lt;/password&amp;gt;&amp;lt;/username&amp;gt;&amp;lt;/port-spec&amp;gt;&amp;lt;/port-spec&amp;gt;&amp;lt;/database-name&amp;gt;&amp;lt;/hostname&amp;gt;&amp;lt;/block-name&amp;gt;&lt;/pre&gt;
 &lt;a href="#top"&gt;Return to top&lt;/a&gt;
 &lt;p&gt;&lt;/p&gt;
+
+##A Name-Cache File&lt;a id="CacheFile"&gt;&lt;/a&gt;
+&lt;a href="#top"&gt;Return to top&lt;/a&gt;
+ 
+&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
+&lt;/p&gt;&lt;pre style="font-family: Arial; line-height: 20px; color: #00008f;"&gt;+# Syslogd2 and DBD2 use the same cache-file format and can share the same files.
+# comments follow the first '#' that can be anywhere in the line.
+# Blank lines or lines containing only whitespace are also considered comments since they are ignored.
+
+# The first address listed for each family will be the "official" address used in reporting &amp;amp; logging. Likewise, the first hostname listed will be the "offiical" name for that host.
+
+# The only rules are:
+# (1) every entry must be contained within one 1024-char line
+# (2) the first hostname in the line will be the 'official' name and the first of v4 or v6 address will be 'official' for that family. All others are CNAMES or aliases.
+# (3) if any line does NOT contain a hostname, the hostname will become the 1st entry in the line.
+
+cixi.sample.com   192.168.15.20  fec4:8:4:892::1049 firewall1.sample.com netscreen1.testsuite.sample.com 10.2.0.40 cixi
+synack.sample.com 10.1.0.30   fec4:8:4:892::200 UnixHost1.example.sample.com databaseserver.testsuite.localdomain.com synack
+NetScreen_Firewall2 Feb4:8:4:892::1028 10.1.0.56 10.1.0.24 10.1.0.99 10.1.0.88 fec4:8:4:892::220 NetScreen2.local.com srx3600a sxr3600a
+10.1.0.19   unknown_fw.sample.com fec0:0:2:40::20 fec0:3:80:90::50 10.0.20.30 172.17.34.193 unkown_fw_alias
+unknown_fw6.sample.com fec0:0:2:40::21 fec0:3:80:90::51 unkown_fw_alias6
+10.1.0.20   unknown_fw4.sample.com 10.0.20.31 172.17.34.194 unkown_fw_alias4
+
+#----------------------------------------------
+# format:
+#     Each line is independent and describes one host.
+#     Whitespace can be anywhere in the line.
+#     Whitespace can be spaces or tabs.
+#     The first name is the "official" (canonical) name used in reporting. All others are recorded as aliases.
+#     The first Ipv4 address is used in reporting &amp;amp; comparisons. All others are recorded as aliases.
+#     The first Ipv6 address is used in reporting &amp;amp; comparisons. All others are recorded as aliases.
+#     Names, IPv4 &amp;amp; IPv6 addresses can be mixed in any order and any quantity.
+
+linux1.localdomain linux1 192.168.2.20 fec0:2::14
+&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
+
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ed Freesmeyer</dc:creator><pubDate>Fri, 01 Jan 2021 09:17:49 -0000</pubDate><guid>https://sourceforge.net07cbe3c26e6e0216398c0df0a8d27f8029073581</guid></item><item><title>SampleFiles modified by Ed Freesmeyer</title><link>https://sourceforge.net/p/dbd2/wiki/SampleFiles/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -38,7 +38,7 @@
     &lt;b&gt;(c)&lt;/b&gt; Defaults option&lt;br/&gt;
     &lt;b&gt;(d)&lt;/b&gt; stderr / logfile (DBD2's "logfile" is an alias for Syslogd2's "stdout")&lt;br/&gt;
     &lt;b&gt;(e)&lt;/b&gt; Enable/Disable options&lt;br/&gt;
-    &lt;b&gt;(f)&lt;/b&gt; No quotes are used anywhere in the configuration file&lt;br/&gt;
+    &lt;b&gt;(f)&lt;/b&gt; No quoted values are used anywhere in the configuration file and all equal-signs are options except where specifically indicated otherwise in documentation.&lt;br/&gt;
     &lt;b&gt;(g)&lt;/b&gt; DBD2 fully supports spaces and tabs in all filenames and directory specifications&lt;br/&gt;
     &lt;p&gt;&lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
     &lt;b&gt;8.&lt;/b&gt; Major differences between DBD2 and Syslogd2 syntax:&lt;br/&gt;
&lt;/p&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ed Freesmeyer</dc:creator><pubDate>Fri, 01 Jan 2021 03:41:58 -0000</pubDate><guid>https://sourceforge.net3e13b0d531f567cfcc372001a915047551f77169</guid></item><item><title>SampleFiles modified by Ed Freesmeyer</title><link>https://sourceforge.net/p/dbd2/wiki/SampleFiles/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -463,11 +463,8 @@
 id=1
 description = An initial test - and - debug  database that writes to an output file for off-line database-insertion.
 file=/Users/ed/Documents/C Projects/nms/dbd/test/outputFile_z,uid=ed,gid=staff,mode=666 #,filter=demo filter, spoolfilemax=4g,spoolfile, sfa= 1,connections=4
-# writers=5
-# lines=200
 enable = syslog,logfile
 logfile=/Users/ed/Documents/C Projects/nms/dbd/test/z.log, uid=ed,gid=staff,mode=666,level=3
-# connections = 4 # this won't really do anything for a 'DB_File' target, but it WILL test the display routine...
  template 1 insert into jobs (rawinput, dbdate, jobid,server_fqdn,server_host,source_fqdn,servertime,end_time,start_time,time,member,sourcehost,sourceip,owner) values ('$1','$2','$3','$4','$5','$6','$7','$8','$9','$10','$11','$12','$13','$14', '$15', [$54]);
  template 3 insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$2','$1','$9','$4','$5','$13','$12','$11');
  template 2 update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';
@@ -479,7 +476,6 @@
 [testdb1] destid = r, type = mysql
 #
 host=localhost.localdomain,port=3306,version=4, ConnectTimeout = 4, WriteTimeout = 3, sf, charset=utf8 # , connections = 4
-# spoolfile=testfile,max=6m,action=1
 username=root # should default to 'A' with an error warning
 logfile=/Users/ed/Documents/C Projects/nms/dbd/test/r.log, uid=ed,gid=staff,mode=666,level=3
 database = test
@@ -489,27 +485,12 @@
 # qlines = 30
 enable  log,cache,dns

-# like variables and templates, filters must be specified one per line.
-# filter options: (no filter allows all incoming traffic to access this database) 3 types: single-address, range, network
-# once a filter is applied, only traffic matching the filter is allowed to post to this database
-# individual addresses separated with commas
-# ranges separated with a dash (inclusive)
-# subnets specified with network-number + '/' + &amp;lt;netmask-or-netmask-bit-count&amp;gt;
-
-# addrfilter=192.168.2.0 - 192.168.2.255
-# addrfilter=fec0:2::0 - fec0:2::ffff
-# addrfilter=192.168.2.20/255.255.255.0 # this should produce a warning and correction that the proper network # is 192.168.2.0
-# addrfilter=fec0:3::1d/ffff:ffff:ffff:: # this should produce a warning and correction that the proper network # is fec0:3:0::
-# addrfilter=192.168.2.79/26
-# addrfilter=192.168.2.20, 192.168.2.22, 192.168.2.24, fec0:2::14
-# addrfilter=fec0:2::14/120
-
 # one entry per logical line
 template = 1insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$3','$14','$6','$11','$9','$10','$13','$12')
 template = 2update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';
 template = 3 insert into test (facility, priority, date, source_host, syslog_host, msg) values ('$36','$37','$47', '$102', '$122', '$53')

-# client call would be: db_client server-hostname server-port "id=8 t=1 o=edfrees id=1 member=`hostname -s` t=`date +%s`"
+# client call would be: db_client server-hostname server-port "id=8 t=r1 o=edfrees id=1 member=`hostname -s` t=`date +%s`"

 # -----------------------------------------------------------------------------------------------
 [testdb1.5] destid = s, type = mysql
@@ -525,27 +506,12 @@
 # qlines = 30
 enable  log,cache,dns

-# like variables and templates, filters must be specified one per line.
-# filter options: (no filter allows all incoming traffic to access this database) 3 types: single-address, range, network
-# once a filter is applied, only traffic matching the filter is allowed to post to this database
-# individual addresses separated with commas
-# ranges separated with a dash (inclusive)
-# subnets specified with network-number + '/' + &amp;lt;netmask-or-netmask-bit-count&amp;gt;
-
-# addrfilter=192.168.2.0 - 192.168.2.255
-# addrfilter=fec0:2::0 - fec0:2::ffff
-# addrfilter=192.168.2.20/255.255.255.0 # this should produce a warning and correction that the proper network # is 192.168.2.0
-# addrfilter=fec0:3::1d/ffff:ffff:ffff:: # this should produce a warning and correction that the proper network # is fec0:3:0::
-# addrfilter=192.168.2.79/26
-# addrfilter=192.168.2.20, 192.168.2.22, 192.168.2.24, fec0:2::14
-# addrfilter=fec0:2::14/120
-
 # one entry per logical line
 template = 1insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$3','$14','$6','$11','$9','$10','$13','$12');
 template = 2update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';
 template = 3 insert into test2 (facility, priority, date, source_host, syslog_host, msg) values ('$36','$37','$47', '$102', '$122', '$53')

-# client call would be: db_client server-hostname server-port "id=8 t=1 o=edfrees id=1 member=`hostname -s` t=`date +%s`"
+# client call would be: db_client server-hostname server-port "id=8 t=s1 o=edfrees id=1 member=`hostname -s` t=`date +%s`"

 # -----------------------------------------------------------------------------------------------

@@ -562,66 +528,20 @@
 id=6
 type = dbi
 socket = /var/lib/mysql/mysql.sock
-version=4 -- obsolete -- moved to a parameter on the 'socket' option
 username=root
 password=


-# -----------------------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------------------------  Invalid database-type
 [testdb4] id=9 type = mssql host=localhost.localdomain,port=3306,version=6,username=root password=
 database = test2
-username=Ann
-password=mother
-#      For this to work, we'll need some number of functions executed locally to act as variables
-#      For now, just:
-#          '$hostname' ('$h') represents the dns-reverse-lookup of the incoming stream-connection IP connection address.
-#      The 'var[n]' lines assign identifying names to the variables that are used in the templates.
-#      The 't[n]' lines are the actual template commands (unique to each database) that accomplish each command.
-#
-#      In this sample database, the 'start_time' and 'end_time' are the date/time the jobs start and end or when the db_client app was launched to record each start/end
-#          the 'log_start_time' and 'log_end_time' fields are the actual database logging times.  the (log_*_time - *_time) values are the # seconds it took for the message to be
-#          transmitted from the cluster client to the database table.
-# socket=/var/tmp/inputsocket, spoolfile=testfile2,sfms=6m, id=1, threadpool = 2
-logfile=/Users/ed/Documents/C Projects/nms/dbd/test/logfile4,uid=ed,gid=staff,level=7,mode=666, connections=1
-# like variables and templates, filters must be specified one per line.
-# filter options: (no filter allows all incoming traffic to access this database) 3 types: single-address, range, network
-# once a filter is applied, only traffic matching the filter is allowed to post to this database
-# individual addresses separated with commas
-# ranges separated with a dash (inclusive)
-# subnets specified with network-number + '/' + &amp;lt;netmask-or-netmask-bit-count&amp;gt;
-
-addrfilter=192.168.2.0 - 192.168.2.255
-addrfilter=fec0:2::0 - fec0:2::ffff
-addrfilter=192.168.2.20/255.255.255.0 # this should produce a warning and correction that the proper network # is 192.168.2.0
-addrfilter=fec0:3::1d/ffff:ffff:ffff:: # this should produce a warning and correction that the proper network # is fec0:3:0::
-addrfilter=192.168.2.79/26
-addrfilter=192.168.2.20, 192.168.2.22, 192.168.2.24, fec0:2::14
-addrfilter=fec0:2::14/120
-
+username=AnnMarie
+password=pwd123

 # $source_host is originating cluster
 template 1  insert into jobs (jobid,owner,source_host,member,time,now, ip,log_start_time=now()) values ($2,'$1$3','$3','$4','$5','$13','$12');
 template 2= update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';

-# t 1  insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$2','$1','$9','$4','$5','$13','$12','$11');
-#
-#CREATE TABLE `jobs` (
-#  `id` int(11) NOT NULL AUTO_INCREMENT,
-#  `jobid` int(11) DEFAULT '-1',
-#  `owner` varchar(32) NOT NULL,
-#  `cluster` varchar(80) DEFAULT '',
-#  `member` varchar(16) DEFAULT NULL,
-#  `start_time` datetime DEFAULT NULL,
-#  `end_time` datetime DEFAULT NULL,
-#  `log_start_time` datetime DEFAULT NULL,
-#  `log_end_time` datetime DEFAULT NULL,
-#  `log_ip` varchar(65) default NULL,
-#  `log_host` varchar(80) DEFAULT '',
-#  PRIMARY KEY (`id`),
-#  KEY `ownerjob` (`owner`,`jobid`,`member`),
-#  KEY `ownerjobdate` (`owner`,`jobid`,`start_time`)
-#);
-# ./dbcl -h 192.168.2.20 -p 1036 "id=8 t=1 username=edfrees member=cn102 jobid=1234 time=`date +%Y%m%d%H%M%S`"
 &amp;lt;/netmask-or-netmask-bit-count&amp;gt;&amp;lt;/netmask-or-netmask-bit-count&amp;gt;&amp;lt;/netmask-or-netmask-bit-count&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="#top"&gt;Return to top&lt;/a&gt;&lt;br/&gt;
 &lt;/p&gt;&lt;br/&gt;
&lt;p&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ed Freesmeyer</dc:creator><pubDate>Thu, 31 Dec 2020 11:56:17 -0000</pubDate><guid>https://sourceforge.netfa46563bb335c845ee9566a057dfb8c72d8e9dc6</guid></item><item><title>SampleFiles modified by Ed Freesmeyer</title><link>https://sourceforge.net/p/dbd2/wiki/SampleFiles/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;a href="../Home" id="top"&gt;Return to Home page&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="contents"&gt;Contents&lt;/h2&gt;
&lt;div style="font-family: Arial; line-height: 20px; color: #00008f; background: none;"&gt;
&lt;table&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;a href="#SyntaxNotes"&gt;Syntax Notes&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;&lt;tr&gt;
            &lt;td&gt;&lt;a href="#Config1"&gt;A Simple (non-syslog) Configuration File&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;&lt;tr&gt;
            &lt;td&gt;&lt;a href="#Config2"&gt;A Configuration File With Syslog Support&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="#top"&gt;Return to top&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="syntax-notes"&gt;Syntax Notes&lt;a id="SyntaxNotes"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href="#top"&gt;Return to top&lt;/a&gt;&lt;/p&gt;
&lt;div style="font-family: Arial; line-height: 20px; color: #00008f; background: none;"&gt;
&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
    &lt;b&gt;1.&lt;/b&gt; Whitespace is ignored.&lt;br/&gt;
    &lt;b&gt;2.&lt;/b&gt; All keywords are non-case-sensitive as are all hostnames.&lt;br/&gt;
    &lt;b&gt;3.&lt;/b&gt; The first "pound-sign" ('#') seen anywhere in a line starts a comment to end-of-line.&lt;br/&gt;
    &lt;b&gt;4.&lt;/b&gt; Lines can be concatenated by putting a backslash character ('\') at the end of a line.&lt;br/&gt;
    &lt;b&gt;5.&lt;/b&gt; DBD2 is designed to work with Syslogd2. It therefore "understands" "extra" facilities, and all time-formats used by Syslogd2 output.&lt;br/&gt;
    &lt;b&gt;6. &lt;/b&gt; DBD2 uses the unmarked "global" section at the top of the file to define all inputs and global values.&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 20px;"&gt;
    &lt;b&gt;(a)&lt;/b&gt; Each option keyword must start a new line.&lt;br/&gt;
    &lt;b&gt;(b)&lt;/b&gt; Many option keywords can be used more than once.&lt;br/&gt;
    &lt;b&gt;(c)&lt;/b&gt; When conflicts occur, the lowest line-number "wins".&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
    &lt;b&gt;7.&lt;/b&gt; DBD2 understands most of the commands and syntax from Syslogd2. This is to simplify configuration via commonalities between the two projects. (It also facilitates code re-use and simplifies concept-transitions between the two projects.). DBD2 does not allow hyphens before the input / global options or multiple options on the same logical line.&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 20px;"&gt;
    &lt;b&gt;(a)&lt;/b&gt; Input option (connection-spec)&lt;br/&gt;
    &lt;b&gt;(b)&lt;/b&gt; ThreadMaps option&lt;br/&gt;
    &lt;b&gt;(c)&lt;/b&gt; Defaults option&lt;br/&gt;
    &lt;b&gt;(d)&lt;/b&gt; stderr / logfile (DBD2's "logfile" is an alias for Syslogd2's "stdout")&lt;br/&gt;
    &lt;b&gt;(e)&lt;/b&gt; Enable/Disable options&lt;br/&gt;
    &lt;b&gt;(f)&lt;/b&gt; No quotes are used anywhere in the configuration file&lt;br/&gt;
    &lt;b&gt;(g)&lt;/b&gt; DBD2 fully supports spaces and tabs in all filenames and directory specifications&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
    &lt;b&gt;8.&lt;/b&gt; Major differences between DBD2 and Syslogd2 syntax:&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 20px;"&gt;
    &lt;b&gt;(a)&lt;/b&gt; DBD2 defaults to TCP (streaming) connections for input and output. This allows for detection of failed connections which is central to the proper operation of the &lt;i&gt;dbcl&lt;/i&gt; client code.&lt;br/&gt;
    &lt;b&gt;(b)&lt;/b&gt; DBD2 is new-concept code, therefore no attempt can be made to be "backwards compatible" with anything. DBD2 makes no effort to "merge" file-content and command-line input as was done with Syslogd2 because of the nature of the DBD input values.&lt;br/&gt;
    &lt;b&gt;(c)&lt;/b&gt; DBD2 uses output &lt;i&gt;sections&lt;/i&gt; delimited by "[&amp;lt;section-name&amp;gt;]" headers instead of single lines to define output destinations. -- Reasons for this change will become apparent when reviewing an actual configuration file.&lt;br/&gt;
    &lt;b&gt;(d)&lt;/b&gt; DBD2 has far fewer CAP_* options&lt;br/&gt;
    &lt;b&gt;(e)&lt;/b&gt; New global options in DBD2:&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 40px;"&gt;
    &lt;b&gt;(1)&lt;/b&gt; &lt;i&gt;var&lt;/i&gt; &amp;lt;sql-number&amp;gt; &amp;lt;comma-separated-list-of-names&amp;gt;&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 60px;"&gt;
    &lt;b&gt;[a]&lt;/b&gt; The non-negative &amp;lt;sql-number&amp;gt; must be globally unique.&lt;br/&gt;
    &lt;b&gt;[b]&lt;/b&gt; The list of names is used to match against incoming &lt;i&gt;dbcl&lt;/i&gt; input.&lt;br/&gt;
    &lt;b&gt;[c]&lt;/b&gt; If the name starts with a dollar-sign ('$'), the name (and &amp;lt;sql-number&amp;gt; refer to an envelope-variable.&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 40px;"&gt;
    &lt;b&gt;(2)&lt;/b&gt; &lt;i&gt;$&lt;/i&gt;: keyword to define a "system-variable"&lt;br/&gt;
    &lt;b&gt;(3)&lt;/b&gt; &lt;i&gt;timestring&lt;/i&gt;: User-customizable string defining time-values. using strftime() format values. (See man page for &lt;i&gt;strftime())&lt;/i&gt;&lt;br/&gt;

    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
    &lt;b&gt;9.&lt;/b&gt; Components of an &lt;b&gt;&lt;i&gt;Output Specification&lt;/i&gt;&lt;/b&gt;:
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 20px;"&gt;
    &lt;b&gt;(a)&lt;/b&gt; An output-id to identify this output section. This is a single letter from 'a' to 'z' (non-case-sensitive).&lt;br/&gt;
    &lt;b&gt;(b)&lt;/b&gt; A section-name to use in error-reporting.&lt;br/&gt;
    &lt;b&gt;(c)&lt;/b&gt; An optional description to remind the administrator of the details of this section.&lt;br/&gt;
    &lt;b&gt;(d)&lt;/b&gt; A host-connection-spec to specify how to connect to this database or file. This &lt;i&gt;connection-spec&lt;/i&gt; variant includes:&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 40px;"&gt;
    &lt;b&gt;(1)&lt;/b&gt; The &lt;i&gt;location&lt;/i&gt; (IP hostname/IP address/Linux Socket-path) to the database connection or file.&lt;br/&gt;
    &lt;b&gt;(2)&lt;/b&gt; Protocol to use (stream or datagram).&lt;br/&gt;
    &lt;b&gt;(3)&lt;/b&gt; Threadpool membership and threadcount values.&lt;br/&gt;
    &lt;b&gt;(4)&lt;/b&gt; IP port and address-family (IPv4 or IPv6) if an IP socket connection: Uid, gid and mode if a file specification.&lt;br/&gt;
    &lt;b&gt;(5)&lt;/b&gt; If MySql-type connection-spec: ConnectTimeout, ReadTimeout, WriteTimeout, Charset and &amp;lt;Max-Connection-Count&amp;gt;&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 20px;"&gt;
    &lt;b&gt;(e)&lt;/b&gt; A destination-type: one of "file", "mysql" or "dbi".&lt;br/&gt;
    &lt;b&gt;(f)&lt;/b&gt; A database name, user-id and password (Mysql and DBI) output-types only.&lt;br/&gt;
    &lt;b&gt;(g)&lt;/b&gt; An optional log-spec (&lt;i&gt;logfile&lt;/i&gt;=) for output-specific logging if output local logging is enabled. If omitted, the global logfile will be used.&lt;br/&gt;
    &lt;b&gt;(h)&lt;/b&gt; A list of &lt;i&gt;templates&lt;/i&gt; that specify the sql to use when inserting / updating data in this database.&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 40px;"&gt;
    &lt;span style="color: #8f0000;"&gt;template = 1 = insert into mytable (f1, f2, f3, f4) values ($1, '$2', '$3', $4);&lt;/span&gt;&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 20px;"&gt;
    &lt;b&gt;(1)&lt;/b&gt; Each template is assigned a non-negative numeric &amp;lt;template-id&amp;gt;. The &amp;lt;database-letter,template-id&amp;gt; forms a &amp;lt;template-spec&amp;gt; such as "a1" and a string of &amp;lt;template-specs&amp;gt; forms a &amp;lt;template-string&amp;gt; ("a1b1c8")&lt;br/&gt;
    &lt;b&gt;(2)&lt;/b&gt; Each template value is a combination of literal characters and sql-variables ('$&amp;lt;sql-number&amp;gt;') where &amp;lt;sql-number&amp;gt; is keyed into the global &lt;i&gt;var&lt;/i&gt; declarations.&lt;br/&gt;
    &lt;/p&gt;&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
    &lt;b&gt;(i)&lt;/b&gt; Output-spec-specific boolean values to be &lt;i&gt;enable&lt;/i&gt;'d or &lt;i&gt;disable&lt;/i&gt;'d for this output-specification.&lt;br/&gt;
&lt;/p&gt;&lt;br/&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="#top"&gt;Return to top&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="non-syslog-configuration-file"&gt;Non-Syslog Configuration File&lt;a id="Config1"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href="#top"&gt;Return to top&lt;/a&gt;&lt;/p&gt;
&lt;div style="font-family: Arial; line-height: 20px; color: #00008f; background: none;"&gt;
&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;
&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="#top"&gt;Return to top&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="configuration-file-with-syslog-support"&gt;Configuration File With Syslog Support&lt;a id="Config2"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href="#top"&gt;Return to top&lt;/a&gt;&lt;/p&gt;
&lt;p style="margin: 0px 0px 0px 10px; padding: 0px 0px;"&gt;

&lt;/p&gt;&lt;pre style="font-family: Arial; line-height: 20px; color: #00008f;"&gt;stderr = /Users/ed/Documents/C Projects/nms/dbd/test/derr, uid=ed, gid=staff, mode=666, level = 7
logfile = /Users/ed/Documents/C Projects/nms/dbd/test/dout, uid=ed,gid=staff,level=7,mode=666

# Config file for dbd (database dump) program. '#' in column 1 is a comment
# All Global settings go above the database-definition blocks
# [&amp;lt;block-name&amp;gt;]
# id=# -&amp;gt; must be a postive (non-negative) integer
# host=&amp;lt;hostname&amp;gt;
# database=&amp;lt;database-name&amp;gt;
# port=&amp;lt;port-spec&amp;gt; # where &amp;lt;port-spec&amp;gt; can be file-pathname, host.port,v=46 as per syslogd2
# type=(mysql)
# username=&amp;lt;username&amp;gt;
# password=&amp;lt;password&amp;gt;

defaults = inputfieldcount 8, globalmsgcount   500
# defaults = templatenames = temp;t
defaults = spooldir=/var/spool/dbd,maxspoolfilesize=3G,readers = 3,workers = 4,writers = 4,connections = 4, lines=20, outputlines = 20
defaults = domainname=sampledomain, hostname=macbook-pro
defaults = configdir=/Users/ed/Documents/C Projects/nms/dbd/test,socketcheckintervals = 30,60,120,300,600,1200,3600,0, cachefile = cachefile.dat

# spooldir=/var/spool/dbd,maxspoolfilesize=3G,readers = 4,workers = 8,writers = 2,connections = 4
# configdir=/Users/ed/Documents/C Projects/nms/dbd/test,socketcheckintervals = 30,60,120,300,600,1200,3600,0, cachefile = cachefile.dat

threads type=input,id=0,readers=1,q=15; type=worker,id=2,w=1, l=25 ; type=input,id=1,r=1,q=0; type=worker,id=1,l=25 ; type=input,id=3; type =output,connections=1,wowrkers=1,lines=25
threads = type=worker,id=4,w=1, l=25 ; type=output,id=5,writers=1,l=25,c=3 ; type=output,id=6,w=1,l=25,c=1

selfaddress = fec0:2::90


# strftime does not define % values for digits, so digits can be used for my own extensions.
# Specifically, there is no default for specifying rfc5424 time format offset of HH:MM rather than %z (HHMM) so a leading modifier of %1 may be assigned to this option.
# a prefix of %1 causes a trailing timezone offset field of %z to be modified to HH:MM instead of the default offset display of HHMM.

timestring = 100 = Test time 1: %w %b %e %H:%M:%S %Y
timestring = 200 = Test time 2: %Y-%b-%dT%H:%M:%SZ
timestring = 300 = Test time 3: %Y-%b=%dT%H:%M:%S%z
timestring = 400 = %1Test time 4: %Y-%b=%dT%H:%M:%S%z
timestring = 500 = Test time 5: %Y%m%d%H%M%S


input = 127.0.0.1,port=1025,v=4, q = 2
input = *,port=1036,v=4 , q = 2
input = *,port=1037,v=4, id=7 , q = 5
input = 127.0.0.1,port=1038,v=6, id=3, s
input = 192.168.2.50,port=1038,v=6, id=3, s
input = localhost,port=1039,v=4, id=3, s
input = fec0:2::90,port=1040,v=6, id=3, s
input = /Users/ed/Documents/C Projects/nms/dbd/test/inputsocket1
input = /Users/ed/Documents/C Projects/nms/syslog/test/testoutputsocket_01
input = /Users/ed/Documents/C Projects/nms/syslog/test/testoutputsocket_02, id=2, s

enable idq # inet, dns, alt-queueing
enable inet = yes, dns, log, cache
# disable IPv6

extra3.notice  a1b2z2
extra17.garbage  z1r2
extra17.debug  z1r2
extra4.* r3
extra5.* s3
extra6.* r3s3

#       The 'var[n]' lines assign identifying names to the variables that are used in the templates.
#       The 't[n]' lines are the actual template commands (unique to each database type) that accomplish each command.
#
#       In this sample database, the 'start_time' and 'end_time' are the date/time the jobs start and end or when the db_client app was launched to record each start/end
#           the 'log_start_time' and 'log_end_time' fields are the actual database logging times.  the (log_*_time - *_time) values are the # seconds it took for the message to be
#           transmitted from the cluster client to the database table.

# The format for a dynamic variable definition is:
#  '$' [=] &amp;lt;column 1=""&amp;gt; [=] &amp;lt;column (a="" list)="" 2="" comma-separated=""&amp;gt; [=] &amp;lt;column of="" list="" 3="" variable-names)="" omma-separated="" (a=""&amp;gt;
#
# System Variable Name Definitions
# Column 1: select a 'field' or 'category' to operate on.
#       'time'
#       'host'
#       'facpri'
#       'msg'
#       'tempalatekey'
#       'RawInput'
# 
# Column 2 (option 'a'): If you selected the 'RawInput' field or the 'templatekey' field, enter 'raw' for 'Column 2' and proceed to Column 3
# 
# Colmnn 2 (option 'b'): the options selected below will form a comma-separated list that will comprise 'Column 2'
#   Select a source:
#       'source' -- the host that sent us the input-string containing the variable we are defining
#       'server' -- the host that is running dbd2 (this host)..
#       'syslog' -- field content will be taken from fields in the incoming syslog messages-string.
#
#   Select a data format:
#       'raw' : use whatever format uses less processing to obtain.
#           // for time+server, this will be 'nuermic+GMTTime
#           // for time+source, this is undefined -- this program cannot determine the time on a remote server.
#           // for time+syslog, this is whatever is in the message's 'time' field
#           // for host+server, this will be whatever is returned from gethostname(). (string)
#           // for host+source, this will be the IP address of the host that sent us this message. (numeric)
#           // for host+syslog, this will be whatever is in the message's 'hostname' field
#           // 'facpri' is undefined for all but syslog sources.
#           // for facpri+syslog, this will be the combined numeric value taken from the syslog message (numeric-facility * 8) + numeric-priority
#           // 'msg' is undefined for all but syslog sources.
#           // for msg+syslog, this will be the actual message string taken from the syslog input. No options other than 'raw' are supported.
#           // 'templatekey' string source is auto-detected based on input msg type and is not dependent on the source of the message.
#
#               -- OR --
#
#       (select a specific data format)
#       'int', 'numeric' : Use numeric values/formats instead of string values/formats.
#       'string' : Use string values/formats for display
#
#       If you selected 'time' + 'string', then Select a string sub-format:
#
#           'db', 'dbTime', 'stringtime': yyyymmddHHMMSS
#           'syslog', 'syslogtime : "mmm dd HH:MM:SS yyyy" (Note that true syslog time format omits the year field)
#           'rfc', 'rfctime' : rfc 1339 internet time format
#
#   Depending on the selection for Column 1, select additional options:
#
#       Column 1 is 'time':
#           'local' : local-time zone
#           'gmt' : GMT timezone (zulu time)
#
#       Column 1 is 'host':
#           if Column2 selected 'string' format:
#               'hostonly', 'nodomain' : strip off all domain elements if present (do DNS lookup if required)
#               'fqdn' : full hostname.domain format -- do dns lookup if required
#
#           if Column2 selected 'int' or 'numeric' format:
#               'ipv4' : display IPv4 address if available, regardless of whether message was received via IPv4 or IPv6.
#               'ipv6' : display IPv6 address if available, regardless of whether message was received via IPv4 or IPv6.
#           Failure to specify an IP family will invoke the global "IPPreference" value of either '4' or '6 to determine which IP Address-family to display if both are available.
#
#       Column 1 is 'facpri': default is to display either the combined numeric value or "&amp;lt;facility-name&amp;gt;.&amp;lt;priority-name&amp;gt;" as a string value.
#           'nofacility', 'nofac' : suppress the facility portion of either the number or the string.
#           'nopriority', 'nopri' : suppores the priority portion of either the number or the string. Numeric facilities will range from 0 ('kern') to 23 ('local7') or higher for 'extra' facilities.
#
# Column 3 is simply a comma-separated list of system-variable names. These will be referenced later by the 'var' keyword to create an actual variable from this definition.
#



#------------------------
#  host fields
#------------------------
$ host source, string, raw = sourceStrRaw
$ host source,string,hostonly = sourceHost
$ host source,string,fqdn = sourceFqdn

$ host source,int,raw = sourceIntRaw
$ host source,int,ipv4 = sourceIPv4
$ host source,numeric,ipv6 = sourceIPv6

$ host server,string,raw = serverStrRaw
$ host server,string,nodomain = serverhost
$ host server,string,fqdn = serverfqdn

$ host server,int,raw = serverIntRaw
$ host server,int,ipv4 = serverIPv4
$ host server,numeric,ipv6 = serverIPv6

$ host syslog,string,raw = syslogStrRaw
$ host syslog,string,nodomain = sysloghost
$ host syslog,string,fqdn = syslogfqdn

$ host syslog,int,raw = syslogIntRaw
$ host syslog,int,ipv4 = syslogIPv4
$ host syslog,numeric,ipv6 = syslogIPv6



#------------------------
#  facpri fields
#------------------------
$ facpri int = intfacpri
$ facpri int,nopriority = intfac
$ facpri int,nofacility = intpri
$ facpri int,nofacility,nopriority = nointpri

$ facpri string = strfacpri
$ facpri string,nopriority = strfac
$ facpri string,nofacility= 5= strpri
$ facpri string,nofacility,nopriority = nostrpri


# $ = time = server,gmttime,int = now, servertime

#------------------------
#  time fields
#------------------------
$ = time = syslog,gmttime,int = timeutc
# $ = time = syslog,gmttime,string,db = dbutc
$ = time = syslog,gmttime,string = 300 = dbutc
#$ time syslog,gmttime,string,rfc = rfcutc
$ time syslog,gmttime,string=200 = rfcutc
$ time syslog,gmttime,string,syslogtime = syslogutc

$ time syslog,local,int = timelocal
$ time syslog,local,string,db = dblocal
$ time syslog,local,string,rfc = rfclocal
$ time syslog,local,string,syslogtime = sysloglocal

#------------------------
#  raw syslog fields
#------------------------
$ facpri syslog,raw = CombinedFacPri
$ time syslog,raw = rawtime
$ host syslog,raw = RawSyslogHost
$ msg syslog,raw = SyslogMsg

#------------------------
# raw syslog vs source input
#------------------------
$ rawinput syslog,raw = RawSyslogInput
$ rawinput = source,raw = rawinput

# one entry per logical line -- numeric range is positive integers.
# incoming data is "name = value",  sql uses $&amp;lt;sql-index&amp;gt; to access &amp;lt;value&amp;gt;
# ************************************************************************************************************
# C A U T I O N:  If the user-defined sql-index numbers are NOT sequential, processing will fail because:
#       NULL ptrs in the SQL2VarArray will cause premature end-of-loop
#       Out-of-squence entries will exceed array boundaries when using sqlIndex as an array-index search-key.
#       Because sql-indices need not be wequential, a random-access key for sql-index -&amp;gt; array-index mappings cannot be used.
# ************************************************************************************************************
# If CAP_SYSLOG is defined and syslog is configured, the 1st 4 fields in this list should be (in order) as follows (variable names and sql values can vary as desired):
# This will allow the hardcoded syslog parsed values to work properly and to have their raw values accessible with simple names.
#
#
# To access raw syslog fields, define &amp;amp; assign dynamic variables with source='syslog', options= "rawinpug"
# The format for a variable definition is:
#  'var' [=] &amp;lt;numeric sql-index=""&amp;gt; [=] &amp;lt;comma-separated variable="" of="" list="" names=""&amp;gt;
#
# To access and use a dynamic-variable definition, prepend a '$' to the dynamic-variable name(s) when specifying the name-list in (column 3).
# The &amp;lt;sql-index&amp;gt; field (column 2) is preceded by a '$' in the template field to access the contents of that variable.
#
#           if template string 1 in database z is: "insert into jobs fields (owner,jobid,start_time) values ('$14', $3, '$9');"
#   and an input string of -t=z1 "user=Tom Jones, start_time=`date \"+%s\"`, job = 156"   will result in the following query string being sent to the database:
#           insert into jobs fields (owner,jobid,start_time) values ('Tome Jones', 156, '&amp;lt;date format="" numeric="" in=""&amp;gt;');
#
# The names in column 3 are used to match against incoming &amp;lt;name =="" value=""&amp;gt; pairs in incoming data strings.
#
# To process syslog messages, the selector-string + template key is defined separately.
# The selector-string is matched against the message facility+priority values in the message to obtain a template key-string.
# A dynamic definition of &amp;lt;field&amp;gt;+"syslog+raw" will access the raw syslog data field components. Other options will provide customized formatting for the contents of those field.
#

var 14=username, user, uid, owner,o
var 3   =jobid, job,id
var 11 =  member,   cluster_member, m                       
var 10  time,t
var 9  start_time 
var 8 end_time
var 7 $servertime
var 6 $source_fqdn
var 5 $server_host
var 4 $server_fqdn
var 13 $sourceip
var 2 $ymdhmslocalintsyslog
var 1 $rawinput
var 27 $rawsysloghostcalc
# var 28 $rawsysloginput
var 29 $rawtimecalc
var 30 $rfctime
var 31 $ymdhmslocalint

# -------------------------------------
# Variables declared for testing host variations -- Template z13
# -------------------------------------
# extra0.=debug z13

var 100 $sourceStrRaw
var 101 $sourceHost
var 102 $sourcefqdn

var 105 $sourceIntRaw
var 106 $sourceIPv4
var 107 $sourceIPv6

var 110 $serverStrRaw
var 111 $serverHost
var 112 $serverfqdn

var 115 $serverIntRaw
var 116 $serverIPv4
var 117 $serverIPv6

var 120 $syslogStrRaw
var 121 $syslogHost
var 122 $syslogfqdn

var 125 $syslogIntRaw
var 126 $syslogIPv4
var 127 $syslogIPv6

# -------------------------------------
# Variables declared for testing facpri variations -- Template z11
# -------------------------------------
# extra0.=info z11

var 30 $intfacpri
var 31 $intfac
var 32 $intpri
var 33 $nointpri

var 35 $strfacpri
var 36 $strfac
var 37 $strpri
var 38 $nostrpri

# -------------------------------------
# Variables declared for testing time manipulation -- Template z10
# -------------------------------------
extra0.=notice z12

var 40 $timeutc
var 41 $dbutc
var 42 $rfcutc
var 43 $syslogutc

var 45 $timelocal
var 46 $dblocal
var 47 $rfclocal
var 48 $sysloglocal

var 60 $servertimeutc
var 61 $serverdbutc
var 62 $serverrfcutc
var 63 $serversyslogutc

var 65 $servertimelocal
var 66 $serverdblocal
var 67 $serverrfclocal
var 68 $serversysloglocal

$ time server,gmttime,int = servertimeutc
$ time server,gmttime,string,db = servertimedbutc
$ time server,gmttime,string,rfc = servertimerfcutc
$ time server,gmttime,string,syslogtime = servertimesyslogutc

$ time server,local,int = servertimelocal
$ time server,local,string,db = servertimedblocal
$ time server,local,string,rfc = servertimerfclocal
$ time server,local,string,syslogtime = servertimesysloglocal


# -------------------------------------
# Variables declared for testing raw syslog fields -- Template z4
# -------------------------------------
# extra0.=warning = z10 # test

# $ rawinput syslog,raw = RawSyslogInput

var 50 $combinedFacPri
var 51 $rawtime
var 52 $rawsysloghost
var 53 $syslogmsg
var 54 $rawsysloginput


# -----------------------------------------------------------------------------------------------
[testfile=z]
type=file
id=1
description = An initial test - and - debug  database that writes to an output file for off-line database-insertion.
file=/Users/ed/Documents/C Projects/nms/dbd/test/outputFile_z,uid=ed,gid=staff,mode=666 #,filter=demo filter, spoolfilemax=4g,spoolfile, sfa= 1,connections=4
# writers=5
# lines=200
enable = syslog,logfile
logfile=/Users/ed/Documents/C Projects/nms/dbd/test/z.log, uid=ed,gid=staff,mode=666,level=3
# connections = 4 # this won't really do anything for a 'DB_File' target, but it WILL test the display routine...
 template 1 insert into jobs (rawinput, dbdate, jobid,server_fqdn,server_host,source_fqdn,servertime,end_time,start_time,time,member,sourcehost,sourceip,owner) values ('$1','$2','$3','$4','$5','$6','$7','$8','$9','$10','$11','$12','$13','$14', '$15', [$54]);
 template 3 insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$2','$1','$9','$4','$5','$13','$12','$11');
 template 2 update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';
template 10 Raw Syslog template: '$50','$51','$52','$53','$54'    '$1'
template 11 Facpri Test: [$30] [$31] [$32] [$33] [$34]          [$35] [$36] [$37] [$38] [$39]
template 12 Time Test: [$40] [$41] [$42] [$43] [$44]          [$45] [$46] [$47] [$48] [$49]
template 13 Host Test: [$100] [$101] [$102] [$103] [$104]     [$105] [$106] [$107] [$108] [$109]  -&amp;gt;  [$110] [$111] [$112] [$113] [$114]     [$115] [$116] [$117] [$118] [$119]  -&amp;gt;   [$120] [$121] [$122] [$123] [$124]     [$125] [$126] [$127] [$128] [$129]
# -----------------------------------------------------------------------------------------------
[testdb1] destid = r, type = mysql
#
host=localhost.localdomain,port=3306,version=4, ConnectTimeout = 4, WriteTimeout = 3, sf, charset=utf8 # , connections = 4
# spoolfile=testfile,max=6m,action=1
username=root # should default to 'A' with an error warning
logfile=/Users/ed/Documents/C Projects/nms/dbd/test/r.log, uid=ed,gid=staff,mode=666,level=3
database = test
password = root
# threadpool = 1
# threads = 6
# qlines = 30
enable  log,cache,dns

# like variables and templates, filters must be specified one per line.
# filter options: (no filter allows all incoming traffic to access this database) 3 types: single-address, range, network
# once a filter is applied, only traffic matching the filter is allowed to post to this database
# individual addresses separated with commas
# ranges separated with a dash (inclusive)
# subnets specified with network-number + '/' + &amp;lt;netmask-or-netmask-bit-count&amp;gt;

# addrfilter=192.168.2.0 - 192.168.2.255
# addrfilter=fec0:2::0 - fec0:2::ffff
# addrfilter=192.168.2.20/255.255.255.0 # this should produce a warning and correction that the proper network # is 192.168.2.0
# addrfilter=fec0:3::1d/ffff:ffff:ffff:: # this should produce a warning and correction that the proper network # is fec0:3:0::
# addrfilter=192.168.2.79/26
# addrfilter=192.168.2.20, 192.168.2.22, 192.168.2.24, fec0:2::14
# addrfilter=fec0:2::14/120

# one entry per logical line
template = 1insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$3','$14','$6','$11','$9','$10','$13','$12')
template = 2update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';
template = 3 insert into test (facility, priority, date, source_host, syslog_host, msg) values ('$36','$37','$47', '$102', '$122', '$53')

# client call would be: db_client server-hostname server-port "id=8 t=1 o=edfrees id=1 member=`hostname -s` t=`date +%s`"

# -----------------------------------------------------------------------------------------------
[testdb1.5] destid = s, type = mysql
#
host=/tmp/mysql.sock, ConnectTimeout = 4, WriteTimeout = 3, sf, charset=utf8 # , connections = 4
# spoolfile=testfile,max=6m,action=1
username=root # should default to 'A' with an error warning
logfile=/Users/ed/Documents/C Projects/nms/dbd/test/s.log, uid=ed,gid=staff,mode=666,level=3
database = test
password = root
# threadpool = 1
# threads = 6
# qlines = 30
enable  log,cache,dns

# like variables and templates, filters must be specified one per line.
# filter options: (no filter allows all incoming traffic to access this database) 3 types: single-address, range, network
# once a filter is applied, only traffic matching the filter is allowed to post to this database
# individual addresses separated with commas
# ranges separated with a dash (inclusive)
# subnets specified with network-number + '/' + &amp;lt;netmask-or-netmask-bit-count&amp;gt;

# addrfilter=192.168.2.0 - 192.168.2.255
# addrfilter=fec0:2::0 - fec0:2::ffff
# addrfilter=192.168.2.20/255.255.255.0 # this should produce a warning and correction that the proper network # is 192.168.2.0
# addrfilter=fec0:3::1d/ffff:ffff:ffff:: # this should produce a warning and correction that the proper network # is fec0:3:0::
# addrfilter=192.168.2.79/26
# addrfilter=192.168.2.20, 192.168.2.22, 192.168.2.24, fec0:2::14
# addrfilter=fec0:2::14/120

# one entry per logical line
template = 1insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$3','$14','$6','$11','$9','$10','$13','$12');
template = 2update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';
template = 3 insert into test2 (facility, priority, date, source_host, syslog_host, msg) values ('$36','$37','$47', '$102', '$122', '$53')

# client call would be: db_client server-hostname server-port "id=8 t=1 o=edfrees id=1 member=`hostname -s` t=`date +%s`"

# -----------------------------------------------------------------------------------------------

[testdb2 = c]
id=4 # same as 'threadpool' or 'threadpoolid'
# tp 2
database = cms
type = mysql
socket = /var/lib/mysql/mysql.sock, version=4
username=root
password=

[testdb3
id=6
type = dbi
socket = /var/lib/mysql/mysql.sock
version=4 -- obsolete -- moved to a parameter on the 'socket' option
username=root
password=


# -----------------------------------------------------------------------------------------------
[testdb4] id=9 type = mssql host=localhost.localdomain,port=3306,version=6,username=root password=
database = test2
username=Ann
password=mother
#       For this to work, we'll need some number of functions executed locally to act as variables
#       For now, just:
#           '$hostname' ('$h') represents the dns-reverse-lookup of the incoming stream-connection IP connection address.
#       The 'var[n]' lines assign identifying names to the variables that are used in the templates.
#       The 't[n]' lines are the actual template commands (unique to each database) that accomplish each command.
#
#       In this sample database, the 'start_time' and 'end_time' are the date/time the jobs start and end or when the db_client app was launched to record each start/end
#           the 'log_start_time' and 'log_end_time' fields are the actual database logging times.  the (log_*_time - *_time) values are the # seconds it took for the message to be
#           transmitted from the cluster client to the database table.
# socket=/var/tmp/inputsocket, spoolfile=testfile2,sfms=6m, id=1, threadpool = 2
logfile=/Users/ed/Documents/C Projects/nms/dbd/test/logfile4,uid=ed,gid=staff,level=7,mode=666, connections=1
# like variables and templates, filters must be specified one per line.
# filter options: (no filter allows all incoming traffic to access this database) 3 types: single-address, range, network
# once a filter is applied, only traffic matching the filter is allowed to post to this database
# individual addresses separated with commas
# ranges separated with a dash (inclusive)
# subnets specified with network-number + '/' + &amp;lt;netmask-or-netmask-bit-count&amp;gt;

addrfilter=192.168.2.0 - 192.168.2.255
addrfilter=fec0:2::0 - fec0:2::ffff
addrfilter=192.168.2.20/255.255.255.0 # this should produce a warning and correction that the proper network # is 192.168.2.0
addrfilter=fec0:3::1d/ffff:ffff:ffff:: # this should produce a warning and correction that the proper network # is fec0:3:0::
addrfilter=192.168.2.79/26
addrfilter=192.168.2.20, 192.168.2.22, 192.168.2.24, fec0:2::14
addrfilter=fec0:2::14/120


# $source_host is originating cluster
template 1  insert into jobs (jobid,owner,source_host,member,time,now, ip,log_start_time=now()) values ($2,'$1$3','$3','$4','$5','$13','$12');
template 2= update jobs set end_time=$5,log_end_time=now() where jobid=$2 and owner=$1 and cluster=$3 and member=$4 and end_time='';

# t 1  insert into jobs (jobid,owner,cluster,member,start_time,log_start_time,log_ip,log_host) values ('$2','$1','$9','$4','$5','$13','$12','$11');
#
#CREATE TABLE `jobs` (
#  `id` int(11) NOT NULL AUTO_INCREMENT,
#  `jobid` int(11) DEFAULT '-1',
#  `owner` varchar(32) NOT NULL,
#  `cluster` varchar(80) DEFAULT '',
#  `member` varchar(16) DEFAULT NULL,
#  `start_time` datetime DEFAULT NULL,
#  `end_time` datetime DEFAULT NULL,
#  `log_start_time` datetime DEFAULT NULL,
#  `log_end_time` datetime DEFAULT NULL,
#  `log_ip` varchar(65) default NULL,
#  `log_host` varchar(80) DEFAULT '',
#  PRIMARY KEY (`id`),
#  KEY `ownerjob` (`owner`,`jobid`,`member`),
#  KEY `ownerjobdate` (`owner`,`jobid`,`start_time`)
#);
# ./dbcl -h 192.168.2.20 -p 1036 "id=8 t=1 username=edfrees member=cn102 jobid=1234 time=`date +%Y%m%d%H%M%S`"
&amp;lt;/netmask-or-netmask-bit-count&amp;gt;&amp;lt;/netmask-or-netmask-bit-count&amp;gt;&amp;lt;/netmask-or-netmask-bit-count&amp;gt;&amp;lt;/field&amp;gt;&amp;lt;/name&amp;gt;&amp;lt;/date&amp;gt;&amp;lt;/sql-index&amp;gt;&amp;lt;/comma-separated&amp;gt;&amp;lt;/numeric&amp;gt;&amp;lt;/value&amp;gt;&amp;lt;/sql-index&amp;gt;&amp;lt;/priority-name&amp;gt;&amp;lt;/facility-name&amp;gt;&amp;lt;/column&amp;gt;&amp;lt;/column&amp;gt;&amp;lt;/column&amp;gt;&amp;lt;/password&amp;gt;&amp;lt;/username&amp;gt;&amp;lt;/port-spec&amp;gt;&amp;lt;/port-spec&amp;gt;&amp;lt;/database-name&amp;gt;&amp;lt;/hostname&amp;gt;&amp;lt;/block-name&amp;gt;&lt;/pre&gt;
&lt;a href="#top"&gt;Return to top&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;



&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ed Freesmeyer</dc:creator><pubDate>Thu, 31 Dec 2020 11:47:56 -0000</pubDate><guid>https://sourceforge.net4c9e5d260cedfd3d6e43c744809f69adb7d1f0ff</guid></item></channel></rss>