lala Reference manual

class lala.WebLogs(*args, **kw)[source]

Custom Pandas dataframe class for reading web logs.

blacklist_ips(ips_blacklist)[source]

Return a new version of self minus the blacklisted ips.

countries_colormap(mini='auto', maxi='auto', ax=None)[source]

Plot a colormap of different countries, return the Matplotlib ax.

Parameters:

country_values

A list of couples (coutry_name, value)

mini, maxi

Extreme values leading to read or white colors. Leave to auto to adjust this range to the values of country_values.

ax

A Matplotlib ax with a representation of the world. If None, one is created automatically

entries_last(num, duration)[source]

Returns the weblogs of the latest entries up to XX ago.

Examples

>>> # Filter out all entries more than 1 hour old
>>> last_hour_weblogs = self.entries_last(1, 'hour')
>>> # Filter out all entries more than 5 days old
>>> last_days_weblogs = self.entries_last(5, 'days')

Return a filtered version of self based on searched terms.

static from_nginx_weblogs(filepath=None, log_lines=None)[source]

Return a dataframe of access log entries, from lines of NGINX logs.

The log_lines are a list of strings, each representing one access logged by NGINX.

identify_ips_domains(logger='bar', known_ips=None)[source]

Add a ip_owner column to self.

plot_geo_positions(ax=None, country_colors=True)[source]

Plot circles on a map around positions of the entries in the access log.

Parameters:

ax

Matplotlib ax with a representation of the world.

plot_piechart(column, ax=None)[source]

Plot circles on a map around positions of the entries in the access log.

Parameters:

column

name of the column to plot

ax

Matplotlib ax on which to plot the pie chart. If None, one is created automatically.

plot_timeline(bins_per_day=4, ax=None)[source]

Plot a time profile of access.

Parameters:

bins_per_day

number of time points per day.

ax

Matplotlib ax on which to plot the profile. If None, one is created automatically.