Skip to content

Instantly share code, notes, and snippets.

@tegud
tegud / grok-url-2.rb
Created January 25, 2015 11:49
Grok regex example
filter {
grok {
match => [ "url_path", "^(?:\/(?<url_language>en|de|es|it|fr))?(?:\/p(?<url_partner>[0-9]+))?(?:\/pv(?<url_partner_value>[0-9a-zA-Z]+))?(?<url_page>.*)$" ]
}
}
@tegud
tegud / grok-url.rb
Created January 25, 2015 11:39
Grok Url Example
filter {
grok { match => [ "url", "%{URIPATH:url_path}%{URIPARAM:url_querystring}?" ] }
}
@tegud
tegud / translate-example.rb
Created January 25, 2015 11:13
Translate Plugin Example
filter {
translate {
regex => true
field => "url_page"
destination => "url_page_type"
fallback => "unknown"
dictionary => [
"\/((k[0-9]+_[a-zA-Z0-9\-\%'()]*)|(r[0-9]+_hotel[a-zA-Z0-9\-\%'()]*)|((H|h)otels(-p[0-9]+)?)|(AjaxSearch|Mobile(Ajax|Search)))\.aspx$", "search"
]
}
var fs = require('fs');
var crypto = require('crypto');
function randomValueBase64 (len) {
return crypto.randomBytes(Math.ceil(len * 3 / 4))
.toString('base64') // convert to base64 format
.slice(0, len) // return required number of characters
.replace(/\+/g, '0') // replace '+' with '0'
.replace(/\//g, '0'); // replace '/' with '0'
}
[
{
"username": "selliott",
"firstName": "Steve",
"lastName": "Elliott",
"email": "not.a.real@address.com",
"password": "fgtdfgjgertu"
}
]
[
{
"username": "selliott",
"firstName": "Steve",
"lastName": "Elliott",
"email": "not.a.real@address.com",
"password": "fgtdfgjgertu",
"javaClass": "com.untangle.uvm.LocalDirectoryUser",
"expirationTime": 0
}
@tegud
tegud / Index.js
Created December 22, 2014 18:38
Untangle Importer
var fs = require('fs');
var crypto = require('crypto');
function randomValueBase64 (len) {
return crypto.randomBytes(Math.ceil(len * 3 / 4))
.toString('base64') // convert to base64 format
.slice(0, len) // return required number of characters
.replace(/\+/g, '0') // replace '+' with '0'
.replace(/\//g, '0'); // replace '/' with '0'
}