{"id":12462,"date":"2018-05-20T00:05:54","date_gmt":"2018-05-20T06:05:54","guid":{"rendered":"http:\/\/anthonyreinke.com\/?p=12462"},"modified":"2019-04-24T20:18:04","modified_gmt":"2019-04-25T02:18:04","slug":"speedcam","status":"publish","type":"post","link":"https:\/\/anthonyreinke.com\/index.php\/2018\/05\/20\/speedcam\/","title":{"rendered":"SpeedCam &#8211; Getting the Data"},"content":{"rendered":"<p>I recently got to be in be on the news for a fun project (see the bottom of the article for the <a href=\"#video\">video<\/a>).\u00a0 We have had issues with cars speeding down our street.\u00a0 I have had the traffic department place the street sign that showed your speed down the street.\u00a0 This did give us some data, but people seeing the signs changed their driving during that drive only.<\/p>\n<p>Being a person that works with data, I thought there has to be a way to track this data source.\u00a0 I tried to build my own system to track the cars going by.\u00a0 After trying a few different things, Arduino and Raspberry Pi, I started reading on using a webcams to track cars.<\/p>\n<p>My setup is as followed:<br \/>\nCamera: HIKVision IP Camera (but a USB camera will work also as shown in the news <a href=\"#video\">video<\/a>)<br \/>\nPower Injector: <a href=\"https:\/\/www.amazon.com\/gp\/product\/B001PS9E5I\">TP-LINK TL-PoE150S<\/a><br \/>\nComputer: Dell Laptop running Windows 10<br \/>\nSpeed Camera Software: <a href=\"http:\/\/www.raserabwehr.de\/\" target=\"_blank\" rel=\"noopener noreferrer\">SpeedCam AI<\/a><br \/>\nData Analyst Tool: <a href=\"https:\/\/splunk.com\">Splunk<\/a><\/p>\n<p>I tried a few different programs and found SpeedCam AI.\u00a0 This program let me draw a rectangle and define the distance.\u00a0 I know that the sections of the street are 15 feet (4.572 meters) in length.<\/p>\n<p><center><a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/DrawLanes.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12483 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/DrawLanes-300x167.png\" alt=\"\" width=\"300\" height=\"167\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/DrawLanes-300x167.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/DrawLanes-537x300.png 537w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/DrawLanes.png 643w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a> <a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/lanes.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12481 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/lanes-200x300.png\" alt=\"\" width=\"200\" height=\"300\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/lanes-200x300.png 200w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/lanes.png 277w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/><\/a><\/center>I set up two different lanes.\u00a0 Lane 1 is for West bound traffic and Lane 2 is for East bound traffic.\u00a0 In the settings you can specify what the delimiter.\u00a0 You can also use the software to save a picture of the vehicle, and clean up the reports.<\/p>\n<p><center><a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/settings3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12470 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/settings3-300x237.png\" alt=\"\" width=\"300\" height=\"237\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/settings3-300x237.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/settings3-768x607.png 768w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/settings3-379x300.png 379w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/settings3.png 802w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/center>With SpeedCam AI writing the details of traffic to a csv file, Splunk can easily ingest the data.<\/p>\n<p><a href=\"https:\/\/youtu.be\/7UGEoz_eYv0\">Installing Splunk on Windows<\/a><br \/>\n<a href=\"https:\/\/youtu.be\/q0OSBugLhak\">Installing Splunk on Linux<\/a><\/p>\n<p>Adding the data to Splunk:<br \/>\nOnce you log in to Splunk, you should see an &#8220;Add Data&#8221; button.<br \/>\n<a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.12-PM.png\"><br \/>\n<\/a><a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.12-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12485 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.12-PM-300x219.png\" alt=\"\" width=\"300\" height=\"219\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.12-PM-300x219.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.12-PM-412x300.png 412w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.12-PM.png 516w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>There is a couple options for bringing the data in.\u00a0 Select &#8220;Monitor&#8221; to be able to continuously bring in the data.<br \/>\n<a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.30-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12486 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.30-PM-300x224.png\" alt=\"\" width=\"300\" height=\"224\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.30-PM-300x224.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.30-PM-402x300.png 402w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.30-PM.png 590w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You will then want to select &#8220;Files &amp; Directories&#8221;.<br \/>\n<a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.44-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12487 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.44-PM-300x51.png\" alt=\"\" width=\"300\" height=\"51\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.44-PM-300x51.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.44-PM-700x119.png 700w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.44-PM.png 728w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Click &#8220;Browse&#8221; to select your &#8220;reports.csv&#8221; file and then click &#8220;Next&#8221;.<br \/>\n<a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12488 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM-300x131.png\" alt=\"\" width=\"300\" height=\"131\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM-300x131.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM-768x335.png 768w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM-1024x447.png 1024w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM-810x354.png 810w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM-1140x498.png 1140w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM-687x300.png 687w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-19-at-11.53.58-PM.png 1150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You should see a preview of your data.\u00a0 You will see that Splunk has identified the data in a csv file.\u00a0 Since the file doesn&#8217;t have a header row, you will need to give it one.\u00a0 In the delimited settings, in the Field names section, click Custom.\u00a0 In this example I used &#8220;datestamp,lane,speed,speedLabel&#8221;.\u00a0 Then click next to continue.<br \/>\n<a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.17.37-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12489 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.17.37-AM-300x146.png\" alt=\"\" width=\"300\" height=\"146\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.17.37-AM-300x146.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.17.37-AM-768x374.png 768w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.17.37-AM-1024x499.png 1024w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.17.37-AM-810x395.png 810w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.17.37-AM-1140x555.png 1140w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.17.37-AM-616x300.png 616w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It should prompt you to save your custom sourcetype.\u00a0 Click Save.<br \/>\n<a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.20.21-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12492 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.20.21-AM-300x115.png\" alt=\"\" width=\"300\" height=\"115\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.20.21-AM-300x115.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.20.21-AM-768x295.png 768w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.20.21-AM-1024x394.png 1024w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.20.21-AM-810x312.png 810w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.20.21-AM-700x269.png 700w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.20.21-AM.png 1092w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I gave the sourcetype name as &#8220;speedcam&#8221;.\u00a0 I then gave it a description and left the category and app the defaults and then click Save.<br \/>\n<a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.02-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12491 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.02-AM-300x198.png\" alt=\"\" width=\"300\" height=\"198\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.02-AM-300x198.png 300w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.02-AM-768x507.png 768w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.02-AM-1024x676.png 1024w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.02-AM-810x535.png 810w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.02-AM-455x300.png 455w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.02-AM.png 1088w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>On the next page we can set the hostname for the data stream. Normally you can leave this the default. In a production environment, we would also want to choose our index. For this example, I am going to leave it as &#8220;Default&#8221;. At this point we can click &#8220;Review&#8221;.<br \/>\n<a href=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.38-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12490 size-medium\" src=\"http:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.38-AM-255x300.png\" alt=\"\" width=\"255\" height=\"300\" srcset=\"https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.38-AM-255x300.png 255w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.38-AM-768x904.png 768w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.38-AM-810x954.png 810w, https:\/\/anthonyreinke.com\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-20-at-12.21.38-AM.png 834w\" sizes=\"auto, (max-width: 255px) 100vw, 255px\" \/><\/a><\/p>\n<p>You can review the setting and then click Submit and it will start bringing in your data.<\/p>\n<hr \/>\n<p>For the Command Line People<br \/>\n<strong>## inputs.conf ##<\/strong><br \/>\n<span style=\"color: #808080;\"><em>[monitor:\/\/c:\\program files(86)\\SpeedCam\\reports\\reports.csv]<br \/>\nsourcetype = speedcam<\/em><\/span><\/p>\n<p><strong>## props.conf ##<\/strong><br \/>\n<span style=\"color: #808080;\"><em>[speedcam]<br \/>\nINDEXED_EXTRACTIONS = CSV<br \/>\nFIELD_DELIMITER = ,<br \/>\nFIELD_NAMES = datestamp,lane,speed,speedLabel<br \/>\nCHECK_FOR_HEADER = false<br \/>\nSHOULD_LINEMERGE = false<\/em><\/span><\/p>\n<hr \/>\n<p>At this point, you have the SpeedCam AI software running and Splunk bringing the data in.\u00a0 I will follow up with another post on the Splunk App I have written.\u00a0 In the mean time, here are a few videos on searching and reporting in Splunk.<\/p>\n<p><a href=\"https:\/\/youtu.be\/xtyH_6iMxwA\">Basic Searching in Splunk<\/a><br \/>\n<a href=\"https:\/\/youtu.be\/L-CnmXEXIug\">Creating Reports in Splunk Enterprise<\/a><br \/>\n<a href=\"https:\/\/youtu.be\/rnm1p5zZPXc\">Create Dashboards in Splunk Enterprise<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently got to be in be on the news for a fun project (see the bottom of the article for the video).\u00a0 We have had issues with cars speeding down our street.\u00a0 I have had the traffic department place the street sign that showed your speed down the street.\u00a0 This did give us some [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[30,23,29,26,28,5,22,24,27,25,15],"class_list":["post-12462","post","type-post","status-publish","format-standard","hentry","category-projects","tag-analyst","tag-cam","tag-data","tag-monitor","tag-neighborhood","tag-project","tag-speed","tag-speedcam","tag-splunk","tag-traffic","tag-windows"],"_links":{"self":[{"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/posts\/12462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/comments?post=12462"}],"version-history":[{"count":9,"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/posts\/12462\/revisions"}],"predecessor-version":[{"id":12639,"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/posts\/12462\/revisions\/12639"}],"wp:attachment":[{"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/media?parent=12462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/categories?post=12462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anthonyreinke.com\/index.php\/wp-json\/wp\/v2\/tags?post=12462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}