[docs] more docs

This commit is contained in:
Timothy Stack 2013-07-27 11:04:43 -07:00
parent 500f1da9f6
commit 25f02eca08
10 changed files with 76 additions and 2 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ src/stamp-h1
src/static-libs/
test/.deps/
test/Makefile
*.pyc

View File

@ -16,7 +16,15 @@ import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
this_dir = os.path.abspath('.')
src_dir = os.path.join(this_dir, "..", "..", "src")
sys.path.insert(0, src_dir)
import format2csv
format2csv.main(["",
os.path.join(src_dir, "default-log-formats.json"),
os.path.join(this_dir, "format-table.csv")])
# -- General configuration -----------------------------------------------------

4
docs/source/config.rst Normal file
View File

@ -0,0 +1,4 @@
Configuration
=============

6
docs/source/data.rst Normal file
View File

@ -0,0 +1,6 @@
Extracting Data
===============
**Note**: This feature is still in **BETA**, you should expect bugs and
incompatible changes in the future.

View File

@ -6,6 +6,11 @@ Log Formats
The following log
.. csv-table::
:header: "Name", "Table Name", "Description"
:widths: 8 5 20
:file: format-table.csv
Modifying an Existing Format
----------------------------

View File

@ -14,7 +14,11 @@ Contents:
:maxdepth: 2
intro
ui
sessions
formats
data
config
hotkeys
Indices and tables
@ -23,4 +27,3 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

4
docs/source/sessions.rst Normal file
View File

@ -0,0 +1,4 @@
Sessions
========

4
docs/source/ui.rst Normal file
View File

@ -0,0 +1,4 @@
User Interface
==============

View File

@ -1,5 +1,7 @@
{
"syslog_log" : {
"title" : "Syslog",
"description" : "The system logger format found on most posix systems.",
"regex" : [
"^(?<timestamp>\\w{3}\\s+\\d{1,2} \\d{2}:\\d{2}:\\d{2})(?: (?<log_hostname>[a-zA-Z0-9:][^ ]+[a-zA-Z0-9]))?(?:(?: (?<log_procname>(?:[^ \\[:]+|[^:]+))(?:\\[(?<log_pid>\\d+)])?:(?<body>.*))|:?(?:(?: ---)? last message repeated \\d+ times?(?: ---)?))"
],
@ -33,6 +35,8 @@
]
},
"access_log" : {
"title" : "Common Access Log",
"description" : "The default web access log format for servers like Apache.",
"regex" : [
"^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?) (?<c_ip>[^ ]+) (?<cs_username>[^ ]+) (?<cs_method>[A-Z]+) (?<cs_uri_stem>[^ \\?]+)(?:\\?(?<cs_uri_query>[^ ]*))? (?:-1|\\d+) (?<sc_status>\\d+) \\d+",
"^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?) (?<c_ip>[^ ]+) (?<cs_username>[^ ]+) (?<cs_method>[A-Z]+) \"(?<cs_uri_stem>[^ \\?]+)(?:\\?(?<cs_uri_query>[^ ]*))?\" (?:-1|\\d+) (?<sc_status>\\d+) \\d+",
@ -90,6 +94,8 @@
]
},
"error_log" : {
"title" : "Common Error Log",
"description" : "The default web error log format for servers like Apache.",
"regex" : [
"^(?<level>\\w) \\[(?<timestamp>[^\\]]+)\\] (?<body>.*)"
],
@ -106,6 +112,8 @@
]
},
"page_log" : {
"title" : "CUPS Page Log",
"description" : "The CUPS server log of printed pages.",
"url" : "http://www.cups.org/documentation.php/doc-1.7/ref-page_log.html",
"regex" : [
"^(?<printer>[\\w_\\-\\.]+) (?<username>[\\w\\.\\-]+) (?<job_id>\\d+) \\[(?<timestamp>[^\\]]+)\\] (?<page_number>total|\\d+) (?<num_copies>\\d+) (?<job_billing>[^ ]+) (?<job_originating_hostname>[\\w\\.:\\-]+)$",
@ -162,6 +170,8 @@
]
},
"vmw_log" : {
"title" : "VMware Logs",
"description" : "One of the log formats used in VMware's ESXi and vCenter software.",
"regex" : ["^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z) \\[(?<tid>\\w+) (?<level>\\w+) '(?<comp>[^']+)'(?: opID=(?<opid>[^ \\]]+))?(?: user=(?<user>[\\w\\-]+))?\\](?<body>.*)$"],
"level-field": "level",
"level" : {
@ -189,6 +199,8 @@
}
},
"choose_repo_log" : {
"title" : "Yum choose_repo Log",
"description" : "The log format for the yum choose_repo tool.",
"regex" : [
"^\\[(?<level>\\w+):[^\\]]+] [^:]+:\\d+ (?<timestamp>\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}:\\d{2}(?:[\\.,]\\d{3})?):(?<body>.*)"
],
@ -206,6 +218,8 @@
]
},
"dpkg_log" : {
"title" : "Dpkg Log",
"description" : "The debian dpkg log.",
"regex" : [
"^(?<timestamp>\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?) (?:(?:(?<action>startup|status|configure|install|upgrade|trigproc|remove|purge)(?: (?<status>config-files|failed-config|half-configured|half-installed|installed|not-installed|post-inst-failed|removal-failed|triggers-awaited|triggers-pending|unpacked))? (?<package>[^ ]+) (?<installed_version>[^ ]+)(?: (?<available_version>[^ ]+))?)|update-alternatives: (?<body>.*))$"
],
@ -242,6 +256,8 @@
]
},
"block_log" : {
"title" : "Generic Block",
"description" : "A generic format for logs, like cron, that have a date at the start of a block.",
"regex" : [
"^(?<timestamp>\\w{3} \\w{3}\\s+\\d{1,2} \\d{2}:\\d{2}:\\d{2} \\w+ \\d{4})$"
],
@ -252,6 +268,8 @@
]
},
"fsck_hfs_log" : {
"title" : "Fsck_hfs Log",
"description" : "Log for the fsck_hfs tool on Mac OS X.",
"regex" : [
"^(?<device>[^:]+): fsck_hfs run at (?<timestamp>\\w{3} \\w{3}\\s+\\d{1,2} \\d{2}:\\d{2}:\\d{2} \\d{4})"
],
@ -268,6 +286,8 @@
]
},
"snaplogic_log" : {
"title" : "SnapLogic Server Log",
"description" : "The SnapLogic server log format.",
"regex" : ["^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?) (?:(?:(?<level>\\w+) (?<logger>[^ ]+) (?<facility>[^ ]+) (?<msgid>[^ ]+) (?<pipe_rid>[^ \\.]+)(?:\\.(?<comp_rid>[^ ]+))? (?<resource_name>[^ ]+) (?<invoker>[^ ]+))|(?:(?:stdout|stderr): ))(?<body>.*)"],
"level-field" : "level",
"level" : {
@ -308,6 +328,8 @@
}
},
"uwsgi_log" : {
"title" : "Uwsgi Log",
"description" : "The uwsgi log format.",
"regex" : [
"^\\[pid: (?<s_pid>\\d+)\\|app: (?<s_app>[\\-\\d]+)\\|req: (?<s_req>[\\-\\d]+)/(?<s_worker_reqs>\\d+)\\] (?<c_ip>[^ ]+) \\((?<cs_username>[^\\)]*)\\) \\{(?<cs_vars>\\d+) vars in (?<cs_bytes>\\d+) bytes\\} \\[(?<timestamp>[^\\]]+)\\] (?<cs_method>[A-Z]+) (?<cs_uri_stem>[^ \\?]+)(?:\\?(?<cs_uri_query>[^ ]*))? => generated (?<sc_bytes>\\d+) bytes in (?<s_runtime>\\d+) (?<rt_unit>\\w+) \\((?<cs_version>[^ ]+) (?<sc_status>\\d+)\\) (?<sc_headers>\\d+) headers in (?<sc_header_bytes>\\d+) bytes \\((?<s_switches>\\d+) switches on core (?<s_core>\\d+)\\)"
],

17
src/format2csv.py Normal file
View File

@ -0,0 +1,17 @@
import csv
import sys
import json
def main(args):
with open(args[1]) as fp:
out = csv.writer(open(args[2], 'w'))
format_dict = json.load(fp)
for key in sorted(format_dict):
value = format_dict[key]
out.writerow((value['title'], key, value['description']))
if __name__ == "__main__":
sys.exit(main(sys.argv))