SiLK LucidWorks Banana
SiLK LucidWorks Banana
SiLK LucidWorks Banana
2
1.1 SiLK Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Banana . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3.1 Banana Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3.2 Dashboard Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.2.1 Bettermap Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.2.2 Column Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.2.3 Filtering Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.2.4 Heatmap Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.2.5 Histogram Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.2.6 Hits Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3.2.7 Map Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3.2.8 Query Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3.2.9 Range Facet Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3.2.10 Table Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.2.11 Terms Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.2.12 Text Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.2.13 Ticker Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.2.14 Timepicker Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.3 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.3.1 Release Notes for v1.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.3.2 Release Notes for v1.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 Solr Writer for Logstash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.1 Solr Writer for Logstash Initial Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.2 Indexing Content to Solr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.5 SiLK Examples and Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.5.1 Apache Weblogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.5.2 Search Analytics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
SiLK
SiLK stands for "Solr integrated with Logstash and Kibana". It includes a custom packaging of Solr,
Banana and a Solr Writer for LogStash. Featured Pages
Banana is a data visualization tool that allows you to create dashboards to display content stored in Banana Installation
your Solr indexes.
Getting started
The Solr Writer for LogStash is a LogStash implementation geared toward indexing your log (or SiLK Installation
other content) to Solr.
Solr Writer for Logstash Initial
Setup
SiLK Installation
The SiLK distribution provides Banana and the Solr Writer for Logstash in one package. The installation is straightfoward: move the .tar.gz
package to an intended location and unzip and untar it.
At that point, you can use Banana with your existing Solr implementation and can configure the Solr Writer for LogStash to index your log files.
The following sections explain how to do this in more detail.
SiLK includes a distribution of Solr 4.8.1. To use the included instance of Solr, you only need to start Solr with java -jar start.jar comman
d found in $SiLK_HOME/SiLK-1.3/solr-4.8.1/SiLK.
Banana Setup
While SiLK includes Solr 4.8.1, if you already have an instance of Solr running, you can simply copy the $SiLK_HOME/banana directory to the
Solr webapp directory. The default location in a new Solr instance is $SOLR_HOME/example/solr-webapp/webapp, but the location may be
different in your instance if you have moved Solr's webapp to another directory for your container. See also the section on Banana Installation for
more information.
There is only one line that needs to be changed to modify both the domain and the port:
solr: "http://localhost:8983/solr/",
After saving the file, you will need to restart the container that is running the webapp.
It's also recommended to change the domain and port in the default dashboard to avoid errors being displayed to users. The location of the
default dashboard also depends on how it was deployed and may be found in either of these locations:
The section to be changed is found at the end of the file and looks like this:
"solr": {
"server": "http://localhost:8983/solr/",
"core_name": "collection1",
"core_list": [
"banana-int",
"collection1",
"logstash_logs",
"logstash_logs_demo"
],
"global_params": "&df=message"
}
Once Banana is set up, you can begin to work with Dashboard Configuration.
There are only a few short steps to setup Solr Writer for Logstash, detailed in the section Solr Writer for Logstash Initial Setup.
Once your environment is ready, indexing data to your Solr instance is described in the section Indexing Content to Solr with Logstash.
Getting started
In this section:
Banana
Banana is the name of the open source port of Kibana 3 available on GitHub at https://github.com/LucidWorks/banana/.
Banana is a tool to create dashboards to visualize data you have stored in Solr. Commonly used with Logstash for log data, any content stored in
a Solr index is eligible for visualization in a Banana dashboard.
In this section, you can find information on Banana Installation (if you have not already installed it as part of SiLK Installation), and detailed
information on Dashboard Configuration.
Banana Installation
These instructions are to install the Banana Web application to run within your existing Solr instance. If you are looking to work with the full SiLK
stack, please see SiLK Installation.
You can get Banana running with your Solr system in these easy steps:
$ cd $SOLR_HOME/example
$ java -jar start.jar
3. Copy the banana directory to the same location you are running the Solr webapp from, such as $SOLR_HOME/example/solr-webapp
/webapp/.
4. Browse to http://localhost:8983/solr/banana/src/index.html#/dashboard. If your Solr port is different from the default port of 8983, you can
edit banana/src/config.js and enter the port you are using.
If you have not yet created the data collections and ingested log data into Solr, you will see an error message saying "Collection not found at ..".
See the section Solr Writer for Logstash to learn how to import data into your Solr instance using LogStash.
If you want to save and load dashboards from Solr, copy either solr-4.4.0/banana-int (for Solr 4.4) or solr-4.5.0/banana-int (for Solr
4.5 and above) directories (as appropriate) into $SOLR_HOME/example/solr in order to setup the required core. Then restart Solr, and if it is
not loaded already, load the core from Solr Admin (if you are using Solr Cloud, you will need to upload the configuration to ZooKeeper and then
create the collection using that configuration).
Dashboard Configuration
The Banana dashboard is made up of several panels that are each configured to show the data Configuring
you would like to see, in the format you would like to see it. Rows
Adding &
The panels are arranged in rows, and each row can be hidden. Each row can contain a number of Editing Panels
panels; the exact number per row depends on the size of the panel.
When configuring the dashboard, be sure to save your changes by clicking the Save icon
at the upper right.
Configuring Rows
To add a row, click Add a Row beneath the last row.
This will bring up the Dashboard Settings menu. To add a row, enter a title for the new row, the height of the row, if it is editable, and then
click Create Row. After the row is created, it will appear in the table of rows, and you can click the up or down arrows to arrange the new row
with the existing rows. You can also use this screen the delete a row, if you'd like.
When you are done, click Close to get back to the dashboard.
You can also click the 'gear' icon to the left of the first panel. This will bring up the row configuration popup, where the last tab is 'Add Panel'.
When adding a panel, the configuration screen varies depending on the required properties for each panel type. From the Add Panel tab, all
of the available properties of each type are displayed, allowing you to define the panel name, the data properties, and any queries that should
be used to limit the data used in the panel.
When editing a panel, however, the view is split between three tabs: General, for name and size configuration; Panel, for the data properties;
and Queries, for defining queries.
The following sections describe the types of panels that can be configured:
bettermap query
column rangeFacet
filtering table
heatmap terms
histogram text
hits ticker
map timepicker
Bettermap Panels
The bettermap panel displays geographic points in clustered groups on a map.
This panel type does not use the terms facet and it does query sequentially. This means that it transfers more data and is generally heavier to
compute, while showing less actual data
If you have a time filter, it will attempt to show to most recent points in your search, up to your defined limit.
Column Panels
A column panel allows you to add other
panels inside it.
Filtering Panels
The filtering panel allows you to see the types of field or date limitations
that have been applied to the dashboard.
Heatmap Panels
Panel tab
Transposed
Histogram Panels
The histogram panel provides a
bucketed time series chart of the current query or queries, using Solr's range facets for data.
If using time-stamped indexes, this panel will query them sequentially to attempt to apply the lightest possible load to your Solr instance or cluster.
Time_field
Chart Settings
Tooltip Settings
The tooltip settings control the display of data when users hover over a line or bar on the chart.
Stacked Values: When using stacked values, this defines if the data be displayed as cumulative, or as individual values.
Display Query: If an alias is set, it will be shown in the tooltip. If no alias is set, enable this to show the entire query.
Hits Panels
The hits panel shows the total hits for the current query input to a query panel.
The properties allow providing a title for the panel, the style of results, and the font size.
Map Panels
A map panel displays a map of shaded regions using any field that contains a 2-letter country or US state code. Regions with more hits are
shaded darker.
This uses the Solr terms facet, so it is important that you set it to the correct field.
Field: the Solr field that has the 2-letter codes that will be used for the location data.
Map: the style of map to display. If your data spans the world, you can choose the world map. If your data is focused on Europe or the US
instead, you can choose the Europe or US maps respectively.
Mode: the approach to summarizing the data. You can chose count, mean, maximum, minimum or sum. In order to use any mode other than
count, the field type must be numeric.
Query Panels
Range selections in the panel are reflected across the entire dashboard.
The properties are very similar to the options for a histogram chart, and defined below.
rangeField
The rangeField defines the field in the index to use as the basis for the range. It must use an integer-based field type.
Chart Settings
The chart settings define how the data will be displayed. There are several options:
Table Panels
The table panel allows you to create
a table of field values from the Solr
index that match the filters applied to
the dashboard. While only the fields
selected are displayed, clicking on
any entry expands to show all fields
of the document.
In the display, you can add new fields on the fly, but clicking a field name from the list in the left side of the panel.
Add Column
Enter the field(s) you would like to see in the table. You can enter as many fields as you'd like, but too many columns may require you to scroll
horizontally to see all of your data.
Click the '+' button to add the field, and you should see it listed in the Columns section to the right. Click on a column to remove it from the list.
Options
Paging
The paging options allow control over how to deal with large amounts of data that may be easier to work with on separate pages.
Terms Panel
The terms panel displays the results of a Solr facet as a pie chart, bar chart, or a table.
A statistics field can be displayed as min/max/mean/sum, faceted by the Solr facet field, again as a pie chart, bar chart or a table.
Field: The field to use as the basis of the facets that are used for display.
Length: The maximum number of terms to display.
Order: The sort order of the facets.
Style: The style of chart, either bar, pie or table.
Legend: If you choose bar or pie as the style, you can then choose no legend, or to display it above or below the data.
Font Size: If you choose table, you will be given the option to define the font size.
Missing
: Enable to display missing values.
Other
:
Donut
: If you choose pie chart as the style, you can choose to display the chart as a donut, with an empty circle in the middle.
Tilt
: If you choose pie chart as the style, you can choose to tilt the chart as an added effect.
Labels
: Enable to show labels in the chart for your data.
Mode
: The mode for the data. Choose
count
,
mean
,
min
, max, or sum. If choosing any mode other than count, the Stats Field selected must be a numeric field.
Stats Field: If you choose any mode other than count, you must then specify the field to use for statistics. This field must be a numeric
field.
Display Precision: Choose the number of digits to display after a decimal point, as appropriate.
Text Panels
A text panel is a free-text panel that allows you to add
descriptions or other text on your dashboard. You can use
plain text, Markdown, or HTML.
When configuring the panel, choose the mode and then enter
the text to display. When entering plain text, you can also
define the font size to use with the display.
Ticker Panels
The ticker panel provides a stock-ticker style representation of how queries are moving
over time.
When configuring a ticker panel, there is one primary property, "Time Ago", which defines
the point in time to use as the basis for comparison.
For example, if the time is 1:10pm, your time picker was set to "Last 10m", and the Time
Ago parameter was set to '1d', the panel would show how much the query results (from the
query panel) have changed since 1:00 to 1:10pm yesterday.
In the example at the right, the timepicker has been set to 30 days, and the ticker panel is set to 1 day. The 0% tells me that there have been no
new documents added to my index in the last day.
Timepicker Panels
The timepicker panel
allows control over the time range filters.
If you have time-based data, or if you're using time stamped indices, you need one of these
.
Default Mode
: The options are
relative
, which provides a series of relative timeframes (such as 30 days ago, 1 year, etc.); absolute, where you define the start and end dates;
or since, where you define only the starting date, with the current date assumed.
Time Field: The field to use for time-based data.
Relative Time Options: When the mode is set to relative, you can provide a comma-separated list of relative time options, such as
"5m,1h,2d". If you use the default range, you should set the panel to span at least 6, to prevent the time selections from overrunning the
edges of the panel.
Default Timespan: The time option that should be selected as a default.
Auto-refresh: When the mode is set to either relative or since, you may want your dashboard to automatically refresh with the latest
data. These options allow you to configure auto-refresh:
Enable: Select to enable auto-refresh.
Interval: The interval, in seconds, to refresh.
Minimum Interval: The minimum interval, in seconds. to refresh.
Release Notes
Release Notes for v1.3
1. This release provides panels for representing geo-spatial data—a map module that provides a heat map-style representation based on
two-letter country codes or US state codes, and a bettermap module that provides a clustered representation of location (LatLonType)
data.
2. The Table Module now has a Save button that enables you to save to csv, JSON or XML formats so that you can use other tools like
Microsoft Excel for further analysis. The number of rows downloaded will be equal to number of “pageable” hits configured in the Paging t
ab within the Table Panel Configuration Menu (accessed by clicking on the cog wheel icon near the top right of the table panel).
3. You can now control whether a dashboard can be saved and/or edited from the Editable checkbox in the General tab, and the Controls ta
b, both within the Dashboard Configurator (accessed from the cog-wheel icon to very top and right of dashboard).
4. We have added a hits panel that provides you with the number of matching results returned while using the global query parameters. This
is useful if you want to make the number prominent or if you are not using the histogram panel prominently.
5. You can now provide additional Global Query Parameters that apply to all panels of the dashboard from the Solr tab in the Dashboard
Configurator. Among other uses, this feature is invaluable for:
a. Specifying a custom query parser (Solr query parameter: &defType) or search handler (&qt)
b. Specifying a user type for use in custom business rules at the Solr server.
c. Specifying default search fields (&df)
6. We fixed a bug in the values mode within the histogram module, where missing values were previously assumed to be zero. This led to
jagged graphs when the “group by” option was used. We no longer set them to zero but rather have the individual lines skip the missing
values.
7. In the Absolute Time and Since modes, the timepicker used to skip back one day if your browser time was behind UTC. This issue has
now been fixed.
8. Banana 1.1 hardcoded certain default search fields (i.e., df) to work with our LogStash output writer. Specifically, it hardcoded a
df=message. This means that your old dashboards may not be fetching query results with Banana 1.2, though they were doing so with
1.1. To fix this, add a Global Query Parameter &df=message (or whatever field you want to search on) within the Dashboard Configurator
. Alternately, you can set the default search field in your solrconfig (recommended).
If you do choose to allow Solr to determine the appropriate fields as log events are being indexed, there are two fields that must be defined in your
schema. These fields are 'timestamp' and 'version'. If these fields do not exist in your schema, they will be added at start of the Logstash job with
a prefix defined in the configuration file for the log processing (such as 'logstash_version' or 'event_timestamp'). If created automatically, these
fields will have the following configuration:
Timestamp
type = tdate
stored = true
indexed = true
Version
type = long
stored = true
indexed = true
The 'version' field discussed here is not the same as the _version_ field that is required for SolrCloud and associated internal tlog
processing.
First, make sure that the logstash_deploy directory contains a .jar file called lucidworks.jar.If it does not, you will need to find it and
Then, copy the file lucidworks_solr_lsv133.rb to the Logstash outputs directory. If using the logstash_deploy directory, the default
location for the output is ./logstash_deploy/logstash/output and you should find the file already there.
From this point, your next step is to set up your configuration files to index content, as described in the next section Indexing Content to Solr.
Note that you should already have created a collection in Solr, or identified an existing collection, that you want to use to store the log events
index.
Solr Writer for Logstash includes a configuration file that can be modified for your environment. The file is lw_solr.conf and is found in the log
stash_deploy directory.
There are several properties to modify in the configuration file, described below.
The lw_solr.conf file starts with the input definitions, as shown in this example:
input {
file {
type => "syslog"
exclude => ["*.gz","*.zip","*.tgz"]
# FYI - Logstash does not always recurse the directory hierarchy correctly
on Windows
# unless the path is all lowercase.
path => [ "/logfilePath/**/./*" ]
sincedb_path => "/dev/null"
start_position => "beginning"
}
}
To modify the path, change the location in line 8 to the correct location of the log files to be processed.
Field definitions
Output location
Finally, the output location defines the location of your Solr instance.
output {
stdout { debug => true codec => "rubydebug"}
lucidworks_solr_lsv133 { collection_host => "localhost" collection_port => "8983"
collection_name => "logstash_logs" field_prefix => "event_" force_commit => false
flush_size => 100 idle_flush_time => 1 }
}
Line 21 of this file contains the definitions for output to a Solr instance. To modify this for your environment, you should change several properties:
collection_host: the address of your Solr instance, defined as a string. If it is not defined, it defaults to 'localhost'.
collection_port: the port of your Solr instance, defined as a string. If it is not defined, it defaults to '8983'.
collection_name: the name of the Solr collection the log events will be indexed to.
field_prefix: the prefix to use when adding the timestamp and version fields (as described in Solr Writer for Logstash Initial Setup). If it is
not defined, it defaults to 'logstash_'. In this case, the lw_solr.conf file has defined it as 'event_'
force_commit: if true, a commit request will be sent to Solr with each batch of documents uploaded. If false, which is the default behavior,
a commit will only occur when the Solr instance is configured to commit.
flush_size: the number of documents to queue as a batch before writing to Solr. This uses Logstash's stud event buffering. If it is not
defined, it will default to 100 events.
idle_flush_time: the amount of time, in seconds, to wait from the last buffer flush before another flush is executed. This flush will be done
even if the number of buffered events is less than the defined flush_size.
Note also that this definition includes a 'stdout' output as well. This will output the processing to the console window. With the debug => true o
ption as defined there, each document will also be output to the console window.
Once the process has finished, your processed log data will be in your Solr instance and available for queries.
Note that this command ends with a period ('.'). This is required for the processing to run.
Apache Weblogs
Using SiLK, it is possible to index your Apache weblogs (from access_log or other log file produced by httpd).
Logstash provides the conversion from the raw log file format to documents that can be indexed by Solr, and Banana provides the data
visualization tools. The source code for this example can be found in the Lucidworks Github repository at https://github.com/LucidWorks/silkuseca
ses/tree/master/apacheweblogs.
Input
From the provided example, you can simply modify the "path" property to the correct location.
input {
file {
path =>
"/Users/ravikrishnamurthy/Documents/src/demo_log_generator/mysamplelogs/lucidfind/webl
ogs/find_searchhub_org_access*"
exclude => ["*.gz","*.zip","*.tgz"]
type => "apache-access"
sincedb_path =>
"/Users/ravikrishnamurthy/Documents/agents/SiLK-1.1/solrWriterForLogStash/logstash_dep
loy/apachelogs.sincedb"
start_position => "beginning"
}
}
Filter
In the provided example, the filter is using several filters together.
grok
The grok filter is included with Logstash by default. Here we have defined the log type as "apache-access", and defined the pattern.
grok {
date
In this section, we are defining what dates will look like in the documents. We have defined the date type as "apache-access" and defined the
date pattern and what field it will go into.
date {
type => "apache-access"
# Try to pull the timestamp from the 'timestamp' field (parsed above with
# grok). The apache time format looks like: "18/Aug/2011:05:44:34 -0700"
match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
}
Unless you have configured your Apache logs to record dates in a different format, it's unlikely there is anything to change here.
geoip
geoip{
source => ["clientip"]
}
mutate
This section defines how we will take the client IP data and parse it into state, country and/or region codes for the index.
mutate{
#timestamp is a field used in LWS. Need to delete it here
remove_field => [ "timestamp"]
# location field for use in clustering and range faceting by LatLon coordinates
add_field => {"geolocation" => "%{[geoip][latitude]},%{[geoip][longitude]}"}
#in map module we want to get two letter state codes for US geography only. Use
region codes elsewhere
if [country] == "US" {
mutate{
rename =>["[geoip][region_name]", "state"]
}
}
else{
mutate{
rename =>["[geoip][region_name]", "region"]
}
}
#now that we have flattened it there is no need for the geoip field.
mutate{
remove_field => ["geoip"]
}
Output
output {
stdout { debug => true codec => "rubydebug"}
lucidworks_solr_lsv133 { collection_host => "localhost" collection_port => "8888"
collection_name => "lucidfindapachelogs" field_prefix => "event_" force_commit =>
false flush_size => 100 idle_flush_time => 1 }
Search Analytics
Once you have built your search application with Apache Solr, the next step is to get information about how it's being used by your target
audience. Using SiLK, you can ingest the log files from your application and use dashboards to analyze the data.
This recipe provides some approaches to answering these questions. The source code for this recipe can be found at https://github.com/LucidWo
rks/silkusecases/tree/master/searchanalytics.
If you are using LucidWorks Search instead of Solr, you can use https://github.com/LucidWorks/silkusecases/blob/master/searchanalyti
cs/silk_lwslogs.conf instead.
input
input {
file {
type => "solrlog"
path => [
"/Users/ravikrishnamurthy/Documents/demos/slk-4.7.0/solr-4.7.0/SiLK/logs/*" ]
#path => [
"/Users/ravikrishnamurthy/Documents/demos/slk-4.7.0/solrWriterForLogStash/logstash_dep
loy/test.log" ]
exclude => ["*.gz","*.zip","*.tgz"]
sincedb_path => "/dev/null"
start_position => "beginning"
}
}
filter
filter {
if [type] == "solrlog" {
grok {
match => ["message", "INFO %{DATA} %{TIMESTAMP_ISO8601:received_at};
%{DATA}; \[%{DATA:collection}\] webapp=%{DATA:webapp} path=%{DATA:searchhandler}
params={%{DATA}q=%{DATA:queryterms}[&}]%{DATA} hits=%{BASE10NUM:hits}
status=%{BASE10NUM:status} QTime=%{BASE10NUM:qtime}"]
}
if ("_grokparsefailure" in [tags]) {
drop{}
}
date {
# Try to pull the time stamp from the 'received_at' field (parsed above with
grok)
match => [ "received_at", "yyyy-MM-dd HH:mm:ss.SSS" ]
}
}
}
output
output {
stdout { debug => true codec => "rubydebug"}
#lucidworks_solr_lsv133 { collection_host => "localhost" collection_port => "8888"
collection_name => "solrlogs" field_prefix => "event_" force_commit => false
flush_size => 1000 idle_flush_time => 1 }
}
Analytics Dashboard