<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=Log_parsing_with_logstash</id>
	<title>Log parsing with logstash - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=Log_parsing_with_logstash"/>
	<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=Log_parsing_with_logstash&amp;action=history"/>
	<updated>2026-04-20T10:04:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://t2bwiki.iihe.ac.be/index.php?title=Log_parsing_with_logstash&amp;diff=572&amp;oldid=prev</id>
		<title>ROMAIN ROUGNY rrougny@vub.ac.be at 15:34, 27 November 2015</title>
		<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=Log_parsing_with_logstash&amp;diff=572&amp;oldid=prev"/>
		<updated>2015-11-27T15:34:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:34, 27 November 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l6&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** &amp;#039;&amp;#039;&amp;#039;/opt/logstash/patterns&amp;#039;&amp;#039;&amp;#039;: contains the patterns that can be used in the filters&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** &amp;#039;&amp;#039;&amp;#039;/opt/logstash/patterns&amp;#039;&amp;#039;&amp;#039;: contains the patterns that can be used in the filters&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* To understand all the eventual patterns to match parts of your log line, have a look at the pattern file &amp;#039;&amp;#039;&amp;#039;grok-patterns&amp;#039;&amp;#039;&amp;#039;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* To understand all the eventual patterns to match parts of your log line, have a look at the pattern file &amp;#039;&amp;#039;&amp;#039;grok-patterns&amp;#039;&amp;#039;&amp;#039;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*&lt;/del&gt;* a pattern looks like:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;::&#039;&#039;&#039; &#039;&#039;[To help you with the patterns and the grok filter, you can use [http://grokconstructor.appspot.com/do/match this excellent site], where you can input log lines, patterns, the section of grok filter related to the patterns, etc, to construct your match.]&#039;&#039;&#039; &#039;&#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;:&lt;/ins&gt;* a pattern looks like:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  PATTERN_1 ${NUMBER:stored_in_my_number}%{SPACE}{IP:ip}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  PATTERN_1 ${NUMBER:stored_in_my_number}%{SPACE}{IP:ip}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  PATTERN_2 %{INT:floor} %{GREEDYDATA:address}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  PATTERN_2 %{INT:floor} %{GREEDYDATA:address}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l28&quot;&gt;Line 28:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 32:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;To help you with the patterns and the grok filter, you can use [http://grokconstructor.appspot.com/do/match this excellent site], where you can input log lines, patterns, the section of grok filter related to the patterns, etc, to construct your match.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* You then need to restart logstash:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* You then need to restart logstash:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>ROMAIN ROUGNY rrougny@vub.ac.be</name></author>
	</entry>
	<entry>
		<id>https://t2bwiki.iihe.ac.be/index.php?title=Log_parsing_with_logstash&amp;diff=570&amp;oldid=prev</id>
		<title>ROMAIN ROUGNY rrougny@vub.ac.be: Created page with &quot;You need to ssh to our elk machine: log10 contains logstash, elasticsearch as well as kibana.  ssh root@log10.iihe.ac.be  * There are 2 directories to work with: ** &#039;&#039;&#039;/etc/lo...&quot;</title>
		<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=Log_parsing_with_logstash&amp;diff=570&amp;oldid=prev"/>
		<updated>2015-11-27T15:14:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;You need to ssh to our elk machine: log10 contains logstash, elasticsearch as well as kibana.  ssh root@log10.iihe.ac.be  * There are 2 directories to work with: ** &amp;#039;&amp;#039;&amp;#039;/etc/lo...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;You need to ssh to our elk machine: log10 contains logstash, elasticsearch as well as kibana.&lt;br /&gt;
 ssh root@log10.iihe.ac.be&lt;br /&gt;
&lt;br /&gt;
* There are 2 directories to work with:&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;/etc/logstash/conf.d/&amp;#039;&amp;#039;&amp;#039; : contains the filters to parse you log lines&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;/opt/logstash/patterns&amp;#039;&amp;#039;&amp;#039;: contains the patterns that can be used in the filters&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* To understand all the eventual patterns to match parts of your log line, have a look at the pattern file &amp;#039;&amp;#039;&amp;#039;grok-patterns&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
** a pattern looks like:&lt;br /&gt;
 PATTERN_1 ${NUMBER:stored_in_my_number}%{SPACE}{IP:ip}&lt;br /&gt;
 PATTERN_2 %{INT:floor} %{GREEDYDATA:address}&lt;br /&gt;
 PATTERN_TOT %{PATTERN_1}%{SPACE}%{PATTERN2}&lt;br /&gt;
:* PATTERN_TOT would match:&lt;br /&gt;
 0412345678   127.0.0.1           666 road to higgs&lt;br /&gt;
&lt;br /&gt;
 my_number =&amp;gt; 0412345678&lt;br /&gt;
 ip        =&amp;gt; 127.0.0.1&lt;br /&gt;
 floor     =&amp;gt; 666&lt;br /&gt;
 address   =&amp;gt; road to higgs&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For logs sent through (r)syslog, there will always be a bunch of information (like timestamp, program used, Facility, host, host_ip) that are prefixed to your log line. It is already extracted in &amp;#039;&amp;#039;&amp;#039;/etc/logstash/conf.d/logstash-complex.conf&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;quot;&amp;lt;%{POSINT:syslog_pri}&amp;gt;%{SYSLOGTIMESTAMP:timestamp} %{IPORHOST:logsource} (?:%{PROG:program}(?:\[%{POSINT:pid}\])?: )?%{GREEDYDATA:msg}&amp;quot;,:&lt;br /&gt;
Therefore your log line is stored in &amp;#039;&amp;#039;&amp;#039;message&amp;#039;&amp;#039;&amp;#039; (msg is mutated in message), and that&amp;#039;s what you need to match using the grok filter. &amp;lt;br&amp;gt;&lt;br /&gt;
To match lines like the example before, expecting you have put the patterns in a file, you just need to make a myservice.conf file in &amp;#039;&amp;#039;&amp;#039;/etc/logstash/conf.d/&amp;#039;&amp;#039;&amp;#039; with:&lt;br /&gt;
 filter{&lt;br /&gt;
  grok { match =&amp;gt; [ &amp;quot;message&amp;quot;, &amp;quot;%{PATTERN_TOT}&amp;quot;] }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
To help you with the patterns and the grok filter, you can use [http://grokconstructor.appspot.com/do/match this excellent site], where you can input log lines, patterns, the section of grok filter related to the patterns, etc, to construct your match.&lt;br /&gt;
&lt;br /&gt;
* You then need to restart logstash:&lt;br /&gt;
 service logstash restart&lt;br /&gt;
&lt;br /&gt;
* Your log lines should now be filtered in the &amp;#039;&amp;#039;&amp;#039;Logstash Search&amp;#039;&amp;#039;&amp;#039; [http://log10.iihe.ac.be/index.html#/dashboard/elasticsearch/Logstash%20Search dashboard].&lt;br /&gt;
:: You should see some new fields appearing for each line of logs if you&amp;#039;ve constructed your grok matching correctly!&lt;/div&gt;</summary>
		<author><name>ROMAIN ROUGNY rrougny@vub.ac.be</name></author>
	</entry>
</feed>