Agenda: exercises-mining-syslog.htm

File exercises-mining-syslog.htm, 34.1 KB (added by pmatsiko, 5 years ago)
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5  <meta http-equiv="Content-Style-Type" content="text/css" />
6  <meta name="generator" content="pandoc" />
7  <title></title>
8  <style type="text/css">code{white-space: pre;}</style>
9  <link href="data:text/css,%2F%2A%0A%20%20%20%20Buttondown%0A%20%20%20%20A%20Markdown%2FMultiMarkdown%2FPandoc%20HTML%20output%20CSS%20stylesheet%0A%20%20%20%20Author%3A%20Ryan%20Gray%0A%20%20%20%20Date%3A%2015%20Feb%202011%0A%20%20%20%20Revised%3A%2021%20Feb%202012%0A%20%20%20%0A%20%20%20%20General%20style%20is%20clean%2C%20with%20minimal%20re%2Ddefinition%20of%20the%20defaults%20or%20%0A%20%20%20%20overrides%20of%20user%20font%20settings%2E%20The%20body%20text%20and%20header%20styles%20are%20%0A%20%20%20%20left%20alone%20except%20title%2C%20author%20and%20date%20classes%20are%20centered%2E%20A%20Pandoc%20TOC%20%0A%20%20%20%20is%20not%20printed%2C%20URLs%20are%20printed%20after%20hyperlinks%20in%20parentheses%2E%20%0A%20%20%20%20Block%20quotes%20are%20italicized%2E%20Tables%20are%20lightly%20styled%20with%20lines%20above%20%0A%20%20%20%20and%20below%20the%20table%20and%20below%20the%20header%20with%20a%20boldface%20header%2E%20Code%20%0A%20%20%20%20blocks%20are%20line%20wrapped%2E%20%0A%20%0A%20%20%20%20All%20elements%20that%20Pandoc%20and%20MultiMarkdown%20use%20should%20be%20listed%20here%2C%20even%20%0A%20%20%20%20if%20the%20style%20is%20empty%20so%20you%20can%20easily%20add%20styling%20to%20anything%2E%0A%20%20%20%20%0A%20%20%20%20There%20are%20some%20elements%20in%20here%20for%20HTML5%20output%20of%20Pandoc%2C%20but%20I%20have%20not%20%0A%20%20%20%20gotten%20around%20to%20testing%20that%20yet%2E%0A%2A%2F%0A%20%0A%2F%2A%20NOTES%3A%0A%20%0A%20%20%20%20Stuff%20tried%20and%20failed%3A%0A%20%20%20%20%0A%20%20%20%20It%20seems%20that%20specifying%20font%2Dfamily%3Aserif%20in%20Safari%20will%20always%20use%20%0A%20%20%20%20Times%20New%20Roman%20rather%20than%20the%20user%27s%20preferences%20setting%2E%0A%20%20%20%20%0A%20%20%20%20Making%20the%20font%20size%20different%20or%20a%20fixed%20value%20for%20print%20in%20case%20the%20screen%20%0A%20%20%20%20font%20size%20is%20making%20the%20print%20font%20too%20big%3A%20Making%20font%2Dsize%20different%20for%20%0A%20%20%20%20print%20than%20for%20screen%20causes%20horizontal%20lines%20to%20disappear%20in%20math%20when%20using%20%0A%20%20%20%20MathJax%20under%20Safari%2E%0A%2A%2F%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Front%20Matter%20%2D%2D%2D%2D%20%2A%2F%0A%20%0A%2F%2A%20Pandoc%20header%20DIV%2E%20Contains%20%2Etitle%2C%20%2Eauthor%20and%20%2Edate%2E%20Comes%20before%20div%23TOC%2E%20%0A%20%20%20Only%20appears%20if%20one%20of%20those%20three%20are%20in%20the%20document%2E%0A%2A%2F%0A%20%0Adiv%23header%2C%20header%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Put%20border%20on%20bottom%2E%20Separates%20it%20from%20TOC%20or%20body%20that%20comes%20after%20it%2E%20%2A%2F%0A%20%20%20%20border%2Dbottom%3A%201px%20solid%20%23aaa%3B%0A%20%20%20%20margin%2Dbottom%3A%200%2E5em%3B%0A%20%20%20%20%7D%0A%20%0A%2Etitle%20%2F%2A%20Pandoc%20title%20header%20%28h1%2Etitle%29%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20text%2Dalign%3A%20center%3B%0A%20%20%20%20%7D%0A%20%0A%2Eauthor%2C%20%2Edate%20%2F%2A%20Pandoc%20author%28s%29%20and%20date%20headers%20%28h2%2Eauthor%20and%20h3%2Edate%29%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20text%2Dalign%3A%20center%3B%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20Pandoc%20table%20of%20contents%20DIV%20when%20using%20the%20%2D%2Dtoc%20option%2E%0A%20%20%20NOTE%3A%20this%20doesn%27t%20support%20Pandoc%27s%20%2D%2Did%2Dprefix%20option%20for%20%23TOC%20and%20%23header%2E%20%0A%20%20%20Probably%20would%20need%20to%20use%20div%5Bid%24%3D%27TOC%27%5D%20and%20div%5Bid%24%3D%27header%27%5D%20as%20selectors%2E%0A%2A%2F%0A%20%0Adiv%23TOC%2C%20nav%23TOC%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Put%20border%20on%20bottom%20to%20separate%20it%20from%20body%2E%20%2A%2F%0A%20%20%20%20border%2Dbottom%3A%201px%20solid%20%23aaa%3B%0A%20%20%20%20margin%2Dbottom%3A%200%2E5em%3B%0A%20%20%20%20%7D%0A%20%0A%40media%20print%0A%20%20%20%20%7B%0A%20%20%20%20div%23TOC%2C%20nav%23TOC%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%2F%2A%20Don%27t%20display%20TOC%20in%20print%20%2A%2F%0A%20%20%20%20%20%20%20%20display%3A%20none%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Headers%20and%20sections%20%2D%2D%2D%2D%20%2A%2F%0A%20%0Ah1%2C%20h2%2C%20h3%2C%20h4%2C%20h5%2C%20h6%0A%7B%0A%20%20%20%20font%2Dfamily%3A%20%22Helvetica%20Neue%22%2C%20Helvetica%2C%20%22Liberation%20Sans%22%2C%20Calibri%2C%20Arial%2C%20sans%2Dserif%3B%20%2F%2A%20Sans%2Dserif%20headers%20%2A%2F%0A%20%0A%20%20%20%20%2F%2A%20font%2Dfamily%3A%20%22Liberation%20Serif%22%2C%20%22Georgia%22%2C%20%22Times%20New%20Roman%22%2C%20serif%3B%20%2F%2A%20Serif%20headers%20%2A%2F%0A%20%0A%20%20%20%20page%2Dbreak%2Dafter%3A%20avoid%3B%20%2F%2A%20Firefox%2C%20Chrome%2C%20and%20Safari%20do%20not%20support%20the%20property%20value%20%22avoid%22%20%2A%2F%0A%7D%0A%20%0A%2F%2A%20Pandoc%20with%20%2D%2Dsection%2Ddivs%20option%20%2A%2F%0A%20%0Adiv%20div%2C%20section%20section%20%2F%2A%20Nested%20sections%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20margin%2Dleft%3A%202em%3B%20%2F%2A%20This%20will%20increasingly%20indent%20nested%20header%20sections%20%2A%2F%0A%20%20%20%20%7D%0A%20%0Ap%20%7B%7D%0A%20%0Ablockquote%0A%20%20%20%20%7B%20%0A%20%20%20%20font%2Dstyle%3A%20italic%3B%0A%20%20%20%20%7D%0A%20%0Ali%20%2F%2A%20All%20list%20items%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0Ali%20%3E%20p%20%2F%2A%20Loosely%20spaced%20list%20item%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20margin%2Dtop%3A%201em%3B%20%2F%2A%20IE%3A%20lack%20of%20space%20above%20a%20%3Cli%3E%20when%20the%20item%20is%20inside%20a%20%3Cp%3E%20%2A%2F%0A%20%20%20%20%7D%0A%20%0Aul%20%2F%2A%20Whole%20unordered%20list%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0Aul%20li%20%2F%2A%20Unordered%20list%20item%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0Aol%20%2F%2A%20Whole%20ordered%20list%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0Aol%20li%20%2F%2A%20Ordered%20list%20item%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0Ahr%20%7B%7D%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Some%20span%20elements%20%2D%2D%2D%20%2A%2F%0A%20%0Asub%20%2F%2A%20Subscripts%2E%20Pandoc%3A%20H%7E2%7EO%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0Asup%20%2F%2A%20Superscripts%2E%20Pandoc%3A%20The%202%5End%5E%20try%2E%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%20%20%20%0Aem%20%2F%2A%20Emphasis%2E%20Markdown%3A%20%2Aemphasis%2A%20or%20%5Femphasis%5F%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%20%20%20%0Aem%20%3E%20em%20%2F%2A%20Emphasis%20within%20emphasis%3A%20%2AThis%20is%20all%20%2Aemphasized%2A%20except%20that%2A%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20font%2Dstyle%3A%20normal%3B%0A%20%20%20%20%7D%0A%20%0Astrong%20%2F%2A%20Markdown%20%2A%2Astrong%2A%2A%20or%20%5F%5Fstrong%5F%5F%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Links%20%28anchors%29%20%2D%2D%2D%2D%20%2A%2F%0A%20%0Aa%20%2F%2A%20All%20links%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Keep%20links%20clean%2E%20On%20screen%2C%20they%20are%20colored%3B%20in%20print%2C%20they%20do%20nothing%20anyway%2E%20%2A%2F%0A%20%20%20%20text%2Ddecoration%3A%20none%3B%0A%20%20%20%20%7D%0A%20%0A%40media%20screen%0A%20%20%20%20%7B%0A%20%20%20%20a%3Ahover%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%2F%2A%20On%20hover%2C%20we%20indicate%20a%20bit%20more%20that%20it%20is%20a%20link%2E%20%2A%2F%0A%20%20%20%20%20%20%20%20text%2Ddecoration%3A%20underline%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%0A%40media%20print%0A%20%20%20%20%7B%0A%20%20%20%20a%20%20%20%7B%0A%20%20%20%20%20%20%20%20%2F%2A%20In%20print%2C%20a%20colored%20link%20is%20useless%2C%20so%20un%2Dstyle%20it%2E%20%2A%2F%0A%20%20%20%20%20%20%20%20color%3A%20black%3B%0A%20%20%20%20%20%20%20%20background%3A%20transparent%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20a%5Bhref%5E%3D%22http%3A%2F%2F%22%5D%3Aafter%2C%20a%5Bhref%5E%3D%22https%3A%2F%2F%22%5D%3Aafter%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%2F%2A%20However%2C%20links%20that%20go%20somewhere%20else%2C%20might%20be%20useful%20to%20the%20reader%2C%0A%20%20%20%20%20%20%20%20%20%20%20so%20for%20http%20and%20https%20links%2C%20print%20the%20URL%20after%20what%20was%20the%20link%20%0A%20%20%20%20%20%20%20%20%20%20%20text%20in%20parens%0A%20%20%20%20%20%20%20%20%2A%2F%0A%20%20%20%20%20%20%20%20content%3A%20%22%20%28%22%20attr%28href%29%20%22%29%20%22%3B%0A%20%20%20%20%20%20%20%20font%2Dsize%3A%2090%25%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Images%20%2D%2D%2D%2D%20%2A%2F%0A%20%0Aimg%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Let%20it%20be%20inline%20left%2Fright%20where%20it%20wants%20to%20be%2C%20but%20verticality%20make%20%0A%20%20%20%20%20%20%20it%20in%20the%20middle%20to%20look%20nicer%2C%20but%20opinions%20differ%2C%20and%20if%20in%20a%20multi%2Dline%20%0A%20%20%20%20%20%20%20paragraph%2C%20it%20might%20not%20be%20so%20great%2E%20%0A%20%20%20%20%2A%2F%0A%20%20%20%20vertical%2Dalign%3A%20middle%3B%0A%20%20%20%20%7D%0A%20%0Adiv%2Efigure%20%2F%2A%20Pandoc%20figure%2Dstyle%20image%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Center%20the%20image%20and%20caption%20%2A%2F%0A%20%20%20%20margin%2Dleft%3A%20auto%3B%0A%20%20%20%20margin%2Dright%3A%20auto%3B%0A%20%20%20%20text%2Dalign%3A%20center%3B%0A%20%20%20%20font%2Dstyle%3A%20italic%3B%0A%20%20%20%20%7D%0A%20%0Ap%2Ecaption%20%2F%2A%20Pandoc%20figure%2Dstyle%20caption%20within%20div%2Efigure%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Inherits%20div%2Efigure%20props%20by%20default%20%2A%2F%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Code%20blocks%20and%20spans%20%2D%2D%2D%2D%20%2A%2F%0A%20%0Apre%2C%20code%20%0A%20%20%20%20%7B%0A%20%20%20%20background%2Dcolor%3A%20%23fdf7ee%3B%0A%20%20%20%20%2F%2A%20BEGIN%20word%20wrap%20%2A%2F%0A%20%20%20%20%2F%2A%20Need%20all%20the%20following%20to%20word%20wrap%20instead%20of%20scroll%20box%20%2A%2F%0A%20%20%20%20%2F%2A%20This%20will%20override%20the%20overflow%3Aauto%20if%20present%20%2A%2F%0A%20%20%20%20white%2Dspace%3A%20pre%2Dwrap%3B%20%2F%2A%20css%2D3%20%2A%2F%0A%20%20%20%20white%2Dspace%3A%20%2Dmoz%2Dpre%2Dwrap%20%21important%3B%20%2F%2A%20Mozilla%2C%20since%201999%20%2A%2F%0A%20%20%20%20white%2Dspace%3A%20%2Dpre%2Dwrap%3B%20%2F%2A%20Opera%204%2D6%20%2A%2F%0A%20%20%20%20white%2Dspace%3A%20%2Do%2Dpre%2Dwrap%3B%20%2F%2A%20Opera%207%20%2A%2F%0A%20%20%20%20word%2Dwrap%3A%20break%2Dword%3B%20%2F%2A%20Internet%20Explorer%205%2E5%2B%20%2A%2F%0A%20%20%20%20%2F%2A%20END%20word%20wrap%20%2A%2F%0A%20%20%20%20%7D%0A%20%0Apre%20%2F%2A%20Code%20blocks%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Distinguish%20pre%20blocks%20from%20other%20text%20by%20more%20than%20the%20font%20with%20a%20background%20tint%2E%20%2A%2F%0A%20%20%20%20padding%3A%200%2E5em%3B%20%2F%2A%20Since%20we%20have%20a%20background%20color%20%2A%2F%0A%20%20%20%20border%2Dradius%3A%205px%3B%20%2F%2A%20Softens%20it%20%2A%2F%0A%20%20%20%20%2F%2A%20Give%20it%20a%20some%20definition%20%2A%2F%0A%20%20%20%20border%3A%201px%20solid%20%23aaa%3B%0A%20%20%20%20%2F%2A%20Set%20it%20off%20left%20and%20right%2C%20seems%20to%20look%20a%20bit%20nicer%20when%20we%20have%20a%20background%20%2A%2F%0A%20%20%20%20margin%2Dleft%3A%20%200%2E5em%3B%0A%20%20%20%20margin%2Dright%3A%200%2E5em%3B%0A%20%20%20%20%7D%0A%20%0A%40media%20screen%0A%20%20%20%20%7B%0A%20%20%20%20pre%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%2F%2A%20On%20screen%2C%20use%20an%20auto%20scroll%20box%20for%20long%20lines%2C%20unless%20word%2Dwrap%20is%20enabled%20%2A%2F%0A%20%20%20%20%20%20%20%20white%2Dspace%3A%20pre%3B%0A%20%20%20%20%20%20%20%20overflow%3A%20auto%3B%0A%20%20%20%20%20%20%20%20%2F%2A%20Dotted%20looks%20better%20on%20screen%20and%20solid%20seems%20to%20print%20better%2E%20%2A%2F%0A%20%20%20%20%20%20%20%20border%3A%201px%20dotted%20%23777%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%0Acode%20%2F%2A%20All%20inline%20code%20spans%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0Ap%20%3E%20code%2C%20li%20%3E%20code%20%2F%2A%20Code%20spans%20in%20paragraphs%20and%20tight%20lists%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Pad%20a%20little%20from%20adjacent%20text%20%2A%2F%0A%20%20%20%20padding%2Dleft%3A%20%202px%3B%0A%20%20%20%20padding%2Dright%3A%202px%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0Ali%20%3E%20p%20code%20%2F%2A%20Code%20span%20in%20a%20loose%20list%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20We%20have%20room%20for%20some%20more%20background%20color%20above%20and%20below%20%2A%2F%0A%20%20%20%20padding%3A%202px%3B%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Math%20%2D%2D%2D%2D%20%2A%2F%0A%20%0Aspan%2Emath%20%2F%2A%20Pandoc%20inline%20math%20default%20and%20%2D%2Djsmath%20inline%20math%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%2F%2A%20Tried%20font%2Dstyle%3Aitalic%20here%2C%20and%20it%20messed%20up%20MathJax%20rendering%20in%20some%20browsers%2E%20Maybe%20don%27t%20mess%20with%20at%20all%2E%20%2A%2F%0A%20%20%20%20%7D%0A%20%20%20%20%0Adiv%2Emath%20%2F%2A%20Pandoc%20%2D%2Djsmath%20display%20math%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%20%20%20%0Aspan%2ELaTeX%20%2F%2A%20Pandoc%20%2D%2Dlatexmathml%20math%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%20%0A%20%0Aeq%20%2F%2A%20Pandoc%20%2D%2Dgladtex%20math%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%20%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Tables%20%2D%2D%2D%2D%20%2A%2F%0A%20%0A%2F%2A%20%20A%20clean%20textbook%2Dlike%20style%20with%20horizontal%20lines%20above%20and%20below%20and%20under%20%0A%20%20%20%20the%20header%2E%20Rows%20highlight%20on%20hover%20to%20help%20scanning%20the%20table%20on%20screen%2E%0A%2A%2F%0A%20%0Atable%0A%20%20%20%20%7B%0A%20%20%20%20border%2Dcollapse%3A%20collapse%3B%0A%20%20%20%20border%2Dspacing%3A%200%3B%20%2F%2A%20IE%206%20%2A%2F%0A%20%0A%20%20%20%20border%2Dbottom%3A%202pt%20solid%20%23000%3B%0A%20%20%20%20border%2Dtop%3A%202pt%20solid%20%23000%3B%20%2F%2A%20The%20caption%20on%20top%20will%20not%20have%20a%20bottom%2Dborder%20%2A%2F%0A%20%0A%20%20%20%20%2F%2A%20Center%20%2A%2F%0A%20%20%20%20margin%2Dleft%3A%20auto%3B%0A%20%20%20%20margin%2Dright%3A%20auto%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0Athead%20%2F%2A%20Entire%20table%20header%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20border%2Dbottom%3A%201pt%20solid%20%23000%3B%0A%20%20%20%20background%2Dcolor%3A%20%23eee%3B%20%2F%2A%20Does%20this%20BG%20print%20well%3F%20%2A%2F%0A%20%20%20%20%7D%0A%20%0Atr%2Eheader%20%2F%2A%20Each%20header%20row%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%20%0A%20%0Atbody%20%2F%2A%20Entire%20table%20%20body%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20Table%20body%20rows%20%2A%2F%0A%20%0Atr%20%20%7B%0A%20%20%20%20%7D%0Atr%2Eodd%3Ahover%2C%20tr%2Eeven%3Ahover%20%2F%2A%20Use%20%2Eodd%20and%20%2Eeven%20classes%20to%20avoid%20styling%20rows%20in%20other%20tables%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20background%2Dcolor%3A%20%23eee%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%2F%2A%20Odd%20and%20even%20rows%20%2A%2F%0Atr%2Eodd%20%7B%7D%0Atr%2Eeven%20%7B%7D%0A%20%0Atd%2C%20th%20%2F%2A%20Table%20cells%20and%20table%20header%20cells%20%2A%2F%0A%20%20%20%20%7B%20%0A%20%20%20%20vertical%2Dalign%3A%20top%3B%20%2F%2A%20Word%20%2A%2F%0A%20%20%20%20vertical%2Dalign%3A%20baseline%3B%20%2F%2A%20Others%20%2A%2F%0A%20%20%20%20padding%2Dleft%3A%20%20%200%2E5em%3B%0A%20%20%20%20padding%2Dright%3A%20%200%2E5em%3B%0A%20%20%20%20padding%2Dtop%3A%20%20%20%200%2E2em%3B%0A%20%20%20%20padding%2Dbottom%3A%200%2E2em%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%2F%2A%20Removes%20padding%20on%20left%20and%20right%20of%20table%20for%20a%20tight%20look%2E%20Good%20if%20thead%20has%20no%20background%20color%2A%2F%0A%2F%2A%0Atr%20td%3Alast%2Dchild%2C%20tr%20th%3Alast%2Dchild%0A%20%20%20%20%7B%0A%20%20%20%20padding%2Dright%3A%200%3B%0A%20%20%20%20%7D%0Atr%20td%3Afirst%2Dchild%2C%20tr%20th%3Afirst%2Dchild%20%0A%20%20%20%20%7B%0A%20%20%20%20padding%2Dleft%3A%200%3B%0A%20%20%20%20%7D%0A%2A%2F%0A%20%0Ath%20%2F%2A%20Table%20header%20cells%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20font%2Dweight%3A%20bold%3B%20%0A%20%20%20%20%7D%0A%20%0Atfoot%20%2F%2A%20Table%20footer%20%28what%20appears%20here%20if%20caption%20is%20on%20top%3F%29%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0Acaption%20%2F%2A%20This%20is%20for%20a%20table%20caption%20tag%2C%20not%20the%20p%2Ecaption%20Pandoc%20uses%20in%20a%20div%2Efigure%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20caption%2Dside%3A%20top%3B%0A%20%20%20%20border%3A%20none%3B%0A%20%20%20%20font%2Dsize%3A%200%2E9em%3B%0A%20%20%20%20font%2Dstyle%3A%20italic%3B%0A%20%20%20%20text%2Dalign%3A%20center%3B%0A%20%20%20%20margin%2Dbottom%3A%200%2E3em%3B%20%2F%2A%20Good%20for%20when%20on%20top%20%2A%2F%0A%20%20%20%20padding%2Dbottom%3A%200%2E2em%3B%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20%2D%2D%2D%2D%20Definition%20lists%20%2D%2D%2D%2D%20%2A%2F%0A%20%0Adl%20%2F%2A%20The%20whole%20list%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20border%2Dtop%3A%202pt%20solid%20black%3B%0A%20%20%20%20padding%2Dtop%3A%200%2E5em%3B%0A%20%20%20%20border%2Dbottom%3A%202pt%20solid%20black%3B%0A%20%20%20%20%7D%0A%20%0Adt%20%2F%2A%20Definition%20term%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20font%2Dweight%3A%20bold%3B%0A%20%20%20%20%7D%0A%20%0Add%2Bdt%20%2F%2A%202nd%20or%20greater%20term%20in%20the%20list%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20border%2Dtop%3A%201pt%20solid%20black%3B%0A%20%20%20%20padding%2Dtop%3A%200%2E5em%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0Add%20%2F%2A%20A%20definition%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20margin%2Dbottom%3A%200%2E5em%3B%0A%20%20%20%20%7D%0A%20%0Add%2Bdd%20%2F%2A%202nd%20or%20greater%20definition%20of%20a%20term%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20border%2Dtop%3A%201px%20solid%20black%3B%20%2F%2A%20To%20separate%20multiple%20definitions%20%2A%2F%0A%20%20%20%20%7D%0A%20%20%20%20%0A%2F%2A%20%2D%2D%2D%2D%20Footnotes%20%2D%2D%2D%2D%20%2A%2F%0A%20%0Aa%2Efootnote%2C%20a%2EfootnoteRef%20%7B%20%2F%2A%20Pandoc%2C%20MultiMarkdown%20footnote%20links%20%2A%2F%0A%20%20%20%20font%2Dsize%3A%20small%3B%20%0A%20%20%20%20vertical%2Dalign%3A%20text%2Dtop%3B%0A%7D%0A%20%0Aa%5Bhref%5E%3D%22%23fnref%22%5D%2C%20a%2Ereversefootnote%20%2F%2A%20Pandoc%2C%20MultiMarkdown%2C%20%3F%3F%20footnote%20back%20links%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0A%40media%20print%0A%20%20%20%20%7B%0A%20%20%20%20a%5Bhref%5E%3D%22%23fnref%22%5D%2C%20a%2Ereversefootnote%20%2F%2A%20Pandoc%2C%20MultiMarkdown%20%2A%2F%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%2F%2A%20Don%27t%20display%20these%20at%20all%20in%20print%20since%20the%20arrow%20is%20only%20something%20to%20click%20on%20%2A%2F%0A%20%20%20%20%20%20%20%20display%3A%20none%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20%0Adiv%2Efootnotes%20%2F%2A%20Pandoc%20footnotes%20div%20at%20end%20of%20the%20document%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%20%20%20%0Adiv%2Efootnotes%20li%5Bid%5E%3D%22fn%22%5D%20%2F%2A%20A%20footnote%20item%20within%20that%20div%20%2A%2F%0A%20%20%20%20%7B%0A%20%20%20%20%7D%0A%20%0A%2F%2A%20You%20can%20class%20stuff%20as%20%22noprint%22%20to%20not%20print%2E%20%0A%20%20%20Useful%20since%20you%20can%27t%20set%20this%20media%20conditional%20inside%20an%20HTML%20element%27s%20%0A%20%20%20style%20attribute%20%28I%20think%29%2C%20and%20you%20don%27t%20want%20to%20make%20another%20stylesheet%20that%20%0A%20%20%20imports%20this%20one%20and%20adds%20a%20class%20just%20to%20do%20this%2E%0A%2A%2F%0A%20%0A%40media%20print%0A%20%20%20%20%7B%0A%20%20%20%20%2Enoprint%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20display%3Anone%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A" rel="stylesheet" type="text/css" />
10</head>
11<body>
12<div id="TOC">
13<ul>
14<li><a href="#analyzing-syslog"><span class="toc-section-number">1</span> Analyzing SYSLOG</a><ul>
15<li><a href="#editing-analyzing-streams-of-text"><span class="toc-section-number">1.1</span> Editing, Analyzing Streams of Text</a><ul>
16<li><a href="#cat"><span class="toc-section-number">1.1.1</span> CAT</a></li>
17<li><a href="#example-show-authentication-attempts-from-auth.log"><span class="toc-section-number">1.1.2</span> Example: Show authentication attempts from 'auth.log'</a></li>
18<li><a href="#example-using-pipes-and-pagers"><span class="toc-section-number">1.1.3</span> Example: Using pipes and pagers</a></li>
19<li><a href="#grep"><span class="toc-section-number">1.1.4</span> GREP</a></li>
20</ul></li>
21</ul></li>
22</ul>
23</div>
24<h1 id="analyzing-syslog"><a href="#analyzing-syslog"><span class="header-section-number">1</span> Analyzing SYSLOG</a></h1>
25<h2 id="editing-analyzing-streams-of-text"><a href="#editing-analyzing-streams-of-text"><span class="header-section-number">1.1</span> Editing, Analyzing Streams of Text</a></h2>
26<p>It is often extremely useful as a Systems / Network admin to be able to edit, display and count fields from text streams. Luckily, Linux distributions like CentOS and Ubuntu come configured with tools for editing and searching streams of text. In this tutorial, we will learn the basics of the following tools:</p>
27<ul>
28<li>cat</li>
29<li>less</li>
30<li>grep</li>
31<li>awk</li>
32</ul>
33<h3 id="cat"><a href="#cat"><span class="header-section-number">1.1.1</span> CAT</a></h3>
34<pre><code>root@ubuntu-server:/var/log# man cat</code></pre>
35<pre><code>NAME
36       cat - concatenate files and print on the standard output
37
38SYNOPSIS
39       cat [OPTION]... [FILE]...
40
41DESCRIPTION
42       Concatenate FILE(s), or standard input, to standard output.
43...</code></pre>
44<h3 id="example-show-authentication-attempts-from-auth.log"><a href="#example-show-authentication-attempts-from-auth.log"><span class="header-section-number">1.1.2</span> Example: Show authentication attempts from 'auth.log'</a></h3>
45<pre><code>root@ubuntu-server:~# cd /var/log
46root@ubuntu-server:/var/log# cat auth.log</code></pre>
47<p>In this very simple example we will take a look at our 'auth.log'. To do so we will use the 'cat' tool.</p>
48<ul>
49<li>'cat' can take an arbitrary number of files and print them to stdout (your terminal). Files will be printed in the order they are listed. For instance, issuing 'cat auth.log kern.log' would print 'auth.log' first, and 'kern.log' second to the terminal.</li>
50</ul>
51<pre><code>root@ubuntu-server:/var/log# cat auth.log
52Jan  5 15:48:51 ubuntu-server sshd[818]: Server listening on 0.0.0.0 port 22.
53Jan  5 15:48:51 ubuntu-server sshd[818]: Server listening on :: port 22.
54Jan  5 15:48:59 ubuntu-server login[899]: pam_unix(login:session): session opened for user bob by LOGIN(uid=0)
55Jan  5 15:53:14 ubuntu-server sudo:      bob : TTY=tty1 ; PWD=/home/bob ; USER=root ; COMMAND=/usr/sbin/dpkg-reconfigure -plow unattended-upgrades
56Jan  5 15:53:14 ubuntu-server sudo: pam_unix(sudo:session): session opened for user root by bob(uid=0)
57Jan  5 15:53:57 ubuntu-server sudo: pam_unix(sudo:session): session closed for user root
58Jan  5 16:17:01 ubuntu-server CRON[1249]: pam_unix(cron:session): session opened for user root by (uid=0)
59Jan  5 16:17:01 ubuntu-server CRON[1249]: pam_unix(cron:session): session closed for user root
60Jan  5 16:18:08 ubuntu-server sudo:      bob : TTY=tty1 ; PWD=/home/bob ; USER=root ; COMMAND=/bin/su -
61Jan  5 16:18:08 ubuntu-server sudo: pam_unix(sudo:session): session opened for user root by bob(uid=0)
62...</code></pre>
63<h3 id="example-using-pipes-and-pagers"><a href="#example-using-pipes-and-pagers"><span class="header-section-number">1.1.3</span> Example: Using pipes and pagers</a></h3>
64<pre><code>root@ubuntu-server:~# cd /var/log
65root@ubuntu-server:/var/log# cat auth.log | less</code></pre>
66<p>In this example, we're doing something rather silly (silly because we don't strictly need 'cat') to illustrate a point. In the first example, we used 'cat' to look at the 'auth.log' file. You may have noticed that this hard to navigate and impossible to search. The solution to this problem is often to pipe to a pager. A pager is a tool used to view (but not change) the contents of a text file one screen at a time. <a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a></p>
67<ul>
68<li>Pagers do not read an entire file into memory at once, they are useful for reading large files</li>
69<li>'less' is by no means the only or best pager, there are many others including 'more'</li>
70<li>'less' starts you at the end of a file</li>
71<li>Notice that we issue a '|' after the 'cat auth.log' above. This is referred to as a 'pipe', it will take the text that was destined for your terminal window and redirect it to another program. In this case, we redirect the text to the pager 'less'.</li>
72</ul>
73<pre><code>Jan  6 09:25:07 ubuntu-server sudo:      bob : TTY=tty1 ; PWD=/home/bob ; USER=root ; COMMAND=/usr/bin/vim /etc/network/interfaces
74Jan  6 09:25:07 ubuntu-server sudo: pam_unix(sudo:session): session opened for user root by bob(uid=0)
75Jan  6 09:25:19 ubuntu-server sudo: pam_unix(sudo:session): session closed for user root
76Jan  6 09:25:42 ubuntu-server sudo:      bob : TTY=tty1 ; PWD=/home/bob ; USER=root ; COMMAND=/usr/sbin/service networking restart
77Jan  6 09:25:42 ubuntu-server sudo: pam_unix(sudo:session): session opened for user root by bob(uid=0)
78Jan  6 09:25:42 ubuntu-server sudo: pam_unix(sudo:session): session closed for user root
79Jan  6 09:25:58 ubuntu-server sudo:      bob : TTY=tty1 ; PWD=/home/bob ; USER=root ; COMMAND=/etc/init.d/networking restart
80Jan  6 09:25:58 ubuntu-server sudo: pam_unix(sudo:session): session opened for user root by bob(uid=0)
81Jan  6 09:25:58 ubuntu-server sudo: pam_unix(sudo:session): session closed for user root
82Jan  6 09:26:01 ubuntu-server sudo:      bob : TTY=tty1 ; PWD=/home/bob ; USER=root ; COMMAND=/sbin/reboot
83Jan  6 09:26:01 ubuntu-server sudo: pam_unix(sudo:session): session opened for user root by bob(uid=0)
84Jan  6 09:26:01 ubuntu-server sudo: pam_unix(sudo:session): session closed for user root
85Jan  6 09:27:57 ubuntu-server sshd[880]: Server listening on 0.0.0.0 port 22.
86Jan  6 09:27:57 ubuntu-server sshd[880]: Server listening on :: port 22.
87Jan  6 09:28:05 ubuntu-server login[997]: pam_unix(login:session): session opened for user bob by LOGIN(uid=0)
88Jan  6 09:33:44 ubuntu-server sshd[1123]: Invalid user rotsted from 192.168.56.1
89Jan  6 09:33:44 ubuntu-server sshd[1123]: input_userauth_request: invalid user rotsted [preauth]
90:/fail</code></pre>
91<ul>
92<li>When you enter 'less', you will see the same text from the previous example, only this time you can use the directional keys to navigate around the text</li>
93<li>There is a ':' at the bottom of the pager. This is the place where you can issue commands to the pager
94<ul>
95<li>'less' allows you to search the text in the pager by placing a <code>/&lt;search string&gt;</code> in the pager's command prompt</li>
96<li>If you wish to exit less type <code>:q</code></li>
97</ul></li>
98</ul>
99<h3 id="grep"><a href="#grep"><span class="header-section-number">1.1.4</span> GREP</a></h3>
100<pre><code>root@ubuntu-server:/var/log# man grep</code></pre>
101<pre><code>NAME
102       grep, egrep, fgrep, rgrep - print lines matching a pattern
103
104SYNOPSIS
105       grep [OPTIONS] PATTERN [FILE...]
106       grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]
107
108DESCRIPTION
109       grep  searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the
110       given PATTERN.  By default, grep prints the matching lines.
111
112       In addition, three variant programs egrep, fgrep and rgrep are available.  egrep is the same as grep -E.  fgrep is the same as grep -F.  rgrep is the  same  as  grep -r.
113       Direct invocation as either egrep or fgrep is deprecated, but is provided to allow historical applications that rely on them to run unmodified.
114...</code></pre>
115<h4 id="example-grep-with-a-file-as-input-find-failed-logins"><a href="#example-grep-with-a-file-as-input-find-failed-logins"><span class="header-section-number">1.1.4.1</span> Example: 'grep' with a file as input, find failed logins</a></h4>
116<pre><code>root@ubuntu-server:/var/log# grep -i &quot;fail&quot; auth.log </code></pre>
117<p>In this example, we will search for failed authentication messages. We will use the following options:</p>
118<pre><code>-F, --fixed-strings
119    Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched.
120-i, --ignore-case
121    Ignore case distinctions in both the PATTERN and the input files.</code></pre>
122<ul>
123<li>By default, grep's pattern matching engine is case sensitive and takes a regular expression as input.</li>
124<li>We use the fixed-string option because we are feeding grep a fixed string as opposed to a regular expression.</li>
125<li>We use the ignore-case option because we want 'grep' to be more 'greedy' or forgiving in matching patterns for us.</li>
126<li>Take a look at the output below, you will notice below that if we did not specify the 'ignore-case' option, we would not have matched the 'sshd' message because 'sshd' has a capital 'F' in it's failure message.</li>
127</ul>
128<pre><code>root@ubuntu-server:/var/log# grep -i &quot;fail&quot; auth.log
129Jan  6 09:24:14 ubuntu-server login[942]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=  user=root
130Jan  6 09:24:17 ubuntu-server login[942]: FAILED LOGIN (1) on '/dev/tty1' FOR 'root', Authentication failure
131Jan  6 09:24:22 ubuntu-server login[942]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=
132Jan  6 09:24:25 ubuntu-server login[942]: FAILED LOGIN (2) on '/dev/tty1' FOR 'UNKNOWN', Authentication failure
133Jan  6 09:25:02 ubuntu-server sudo: pam_unix(sudo:auth): authentication failure; logname=bob uid=1000 euid=0 tty=/dev/tty1 ruser=bob rhost=  user=bob
134Jan  6 17:27:35 ubuntu-server sudo: pam_unix(sudo:auth): authentication failure; logname=bob uid=1000 euid=0 tty=/dev/pts/0 ruser=bob rhost=  user=bob
135Jan  7 13:36:09 ubuntu-server sudo: pam_unix(sudo:auth): authentication failure; logname=bob uid=1000 euid=0 tty=/dev/pts/0 ruser=bob rhost=  user=bob
136Jan  7 13:36:13 ubuntu-server sudo: pam_unix(sudo:auth): conversation failed
137Jan  7 17:31:17 ubuntu-server sudo: pam_unix(sudo:auth): authentication failure; logname=bob uid=1000 euid=0 tty=/dev/pts/0 ruser=bob rhost=  user=bob
138Jan  7 17:31:22 ubuntu-server sshd[4465]: Failed password for root from 192.168.56.1 port 59379 ssh2</code></pre>
139<h4 id="example-extract-ip-for-failed-logins-using-awk"><a href="#example-extract-ip-for-failed-logins-using-awk"><span class="header-section-number">1.1.4.2</span> Example: Extract IP for failed logins using awk</a></h4>
140<pre><code>root@ubuntu-server:/var/log# grep -i &quot;Failed password&quot; auth.log | awk '{ print $11 }'</code></pre>
141<ul>
142<li>In the previous examples, we looked at excerpts from the man pages. The 'awk' man page is rather difficult to follow, so I will forego it in this example.</li>
143<li>Today we're going to stick to a very simple use for awk: extracting fields from log files</li>
144</ul>
145<p><strong>1. Find the 'sshd' logs that indicate a 'failed' login.</strong></p>
146<p>In the previous example, we used 'grep' to find all log messages with the term &quot;fail&quot; in them. Lets try that again, this time, lets only match messages that contain the string 'sshd'. One way to accomplish this is to pipe one 'grep' into another:</p>
147<pre><code>root@ubuntu-server:/var/log# grep -iF &quot;sshd&quot; auth.log | grep -iF &quot;fail&quot;
148Jan  7 17:31:22 ubuntu-server sshd[4465]: Failed password for root from 192.168.56.1 port 59379 ssh2
149Jan  7 17:31:22 ubuntu-server sshd[4465]: Failed password for root from 192.168.56.1 port 59379 ssh2
150Jan  7 17:31:36 ubuntu-server sshd[4473]: Failed password for root from 192.168.56.1 port 59383 ssh2
151Jan  7 17:31:37 ubuntu-server sshd[4473]: Failed password for root from 192.168.56.1 port 59383 ssh2
152Jan  7 22:38:04 ubuntu-server sshd[5073]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.56.1  user=root
153Jan  7 22:38:06 ubuntu-server sshd[5073]: Failed password for root from 192.168.56.1 port 53875 ssh2
154Jan 21 15:33:17 ubuntu-server sshd[2595]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost  user=root
155Jan 21 15:33:19 ubuntu-server sshd[2595]: Failed password for root from ::1 port 58866 ssh2
156Jan 21 15:33:26 ubuntu-server sshd[2595]: message repeated 2 times: [ Failed password for root from ::1 port 58866 ssh2]
157Jan 21 15:33:26 ubuntu-server sshd[2595]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost  user=root</code></pre>
158<p><strong>2. Now that we know the format of these messages, find the field number for the source IP</strong></p>
159<ul>
160<li>The 'auth.log' is formatted in a 'space delimited' fashion -- white space is used to delimit the data contained in the log.</li>
161<li>Pretend for a moment that each field of the log has a number associated with it, starting with the number 1</li>
162<li>Counting from the left to right there are 14 space delimited fields, the field we're interested in, the source IP is at field 12</li>
163</ul>
164<pre><code>1    2 3        4             5           6      7        8   9    10   11           12   13    14 
165Jan  7 22:38:06 ubuntu-server sshd[5073]: Failed password for root from 192.168.56.1 port 53875 ssh2</code></pre>
166<p><strong>3. Craft an 'awk' command that will extract the 11th field.</strong></p>
167<ul>
168<li>'awk' commands consist of a pattern and an action. A pattern defines the text to which awk applies an action.</li>
169<li>'awk' actions are always contained within curly brackets: <code>awk '&lt;pattern&gt; { &lt;action&gt; } &lt;file&gt;'</code></li>
170<li>We will use 'grep' to select the lines to pipe to 'awk' instead of a selector pattern.</li>
171<li>We will be piping to 'awk' we will not need to provide a file to the 'awk' command</li>
172<li>The action we want to perform is &quot;print&quot; field 11: <code>awk '{print $11}'</code></li>
173<li>Note: If we wanted to, we could use the following 'awk' command to select and print lines: <code>awk '/sshd.*Fail/ { print }' auth.log</code></li>
174</ul>
175<p><strong>4. Execute the command!</strong></p>
176<pre><code>root@ubuntu-server:/var/log# grep -i &quot;Failed password&quot; auth.log | awk '{ print $11 }'
177192.168.56.1
178192.168.56.1
179192.168.56.1
180192.168.56.1
181192.168.56.1
182::1</code></pre>
183<div class="footnotes">
184<hr />
185<ol>
186<li id="fn1"><p>http://en.wikipedia.org/wiki/Less_(Unix)<a href="#fnref1"></a></p></li>
187</ol>
188</div>
189</body>
190</html>