Skip to content

Instantly share code, notes, and snippets.

@vicendominguez
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vicendominguez/0c7d3f3a37391035ace4 to your computer and use it in GitHub Desktop.
Save vicendominguez/0c7d3f3a37391035ace4 to your computer and use it in GitHub Desktop.
wowza logs to json via nxlog (first try)
## This is a sample configuration file. See the nxlog reference manual about the
## configuration options. It should be installed locally under
## /usr/share/doc/nxlog-ce/ and is also available online at
## http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html
########################################
# Global directives #
########################################
User nxlog
Group nxlog
LogFile /var/log/nxlog/nxlog.log
LogLevel INFO
########################################
# Modules #
########################################
<Extension json>
Module xm_json
</Extension>
<Extension wowza>
Module xm_csv
Fields $date, $time, $tz, $x-event, $x-category, $x-severity, $x-status, $x-ctx, $x-comment, $x-vhost, $x-app, $x-appinst, $x-duration, $s-ip, $s-port, $s-uri, $c-ip, $c-proto, $c-referrer, $c-user-agent, $c-client-id, $cs-bytes, $sc-bytes, $x-stream-id, $x-spos, $cs-stream-bytes, $sc-stream-bytes, $x-sname, $x-sname-query, $x-file-name, $x-file-ext, $x-file-size, $x-file-length, $x-suri, $x-suri-stem, $x-suri-query, $cs-uri-stem, $cs-uri-query
Delimiter \t
</Extension>
<Extension charconv>
Module xm_charconv
AutodetectCharsets utf-8, utf-16, utf-32, iso8859-2, windows-1252
</Extension>
<Input in_wowza>
Module im_file
File '/home/wowzalogs/wowzamediaserver_access.log'
ReadFromLast FALSE
Exec convert_fields("windows-1252", "utf-8");
</Input>
<Output out_rest>
Module om_http
ContentType application/json
Exec if $raw_event =~ /^#/ drop(); \
else \
{ \
wowza->parse_csv(); \
$EventReceivedTime = parsedate($date + " " + $time);\
to_json (); \
}
URL http://192.168.43.61/nxlog/
</Output>
<Output out_json>
Module om_file
Exec if $raw_event =~ /^#/ drop(); \
else \
{ \
wowza->parse_csv(); \
$EventReceivedTime = parsedate($date + " " + $time);\
to_json (); \
}
File "/tmp/file.json"
</Output>
########################################
# Routes #
########################################
<Route 1>
Path in_wowza => out_rest
</Route>
<Route 2>
Path in_wowza => out_json
</Route>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment