Caddy log parser
+ ++ +
diff --git a/src/caddy-log-parser/index.html b/src/caddy-log-parser/index.html new file mode 100644 index 0000000..e15b32a --- /dev/null +++ b/src/caddy-log-parser/index.html @@ -0,0 +1,23 @@ + + +
+ + +${JSON.stringify(json, null, 2)}
+ `;
+ return section;
+}
+
+function onSubmit(event) {
+ event.preventDefault();
+ const fileInput = document.getElementById('file');
+ const file = fileInput.files[0];
+ const reader = new FileReader();
+ const output = document.getElementById('output');
+
+ reader.onload = function(e) {
+ const contents = e.target.result;
+ const lines = contents.split('\n');
+ output.innerHTML = '';
+
+ for (let line of lines) {
+ let json;
+ try {
+ json = JSON.parse(line);
+ } catch (e) {
+ console.error('Error parsing line: ', line);
+ console.error(e);
+ continue;
+ }
+ console.debug(json);
+ if(json.logger.includes("http.log.access")) {
+ const section = createAccessLogSection(json);
+ output.appendChild(section);
+ }
+ };
+
+ fileInput.value = null;
+ };
+
+ reader.readAsText(file);
+}
+
+
+function addListener() {
+ const form = document.getElementsByTagName('form')[0];
+ form.addEventListener(
+ "submit",
+ onSubmit
+ )
+}
+
+
+document.addEventListener("DOMContentLoaded", addListener);
diff --git a/src/caddy-log-parser/style.css b/src/caddy-log-parser/style.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/faq.css b/src/faq.css
index eda2aba..88c0893 100644
--- a/src/faq.css
+++ b/src/faq.css
@@ -10,26 +10,3 @@
.question p {
font-size: large
}
-
-code.block {
- display: block;
- padding: 1em;
- margin: 1em 0;
- background-color: #1f1f1f;
- color: #dcdcdc;
- font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
- font-size: 14px;
- line-height: 1.5;
- border-radius: 5px;
- overflow-x: auto;
-}
-
-code.inline {
- background-color: #1f1f1f;
- color: #dcdcdc;
- font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
- font-size: initial;
- line-height: 1.2;
- border-radius: 3px;
- padding: 0.4em 0.6em;
-}
diff --git a/src/index.css b/src/index.css
index ee49567..22f629e 100644
--- a/src/index.css
+++ b/src/index.css
@@ -108,3 +108,25 @@ table tr:hover {
font-weight: bold;
}
+code.block {
+ display: block;
+ padding: 1em;
+ margin: 1em 0;
+ background-color: #1f1f1f;
+ color: #dcdcdc;
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
+ font-size: 14px;
+ line-height: 1.5;
+ border-radius: 5px;
+ overflow-x: auto;
+}
+
+code.inline {
+ background-color: #1f1f1f;
+ color: #dcdcdc;
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
+ font-size: initial;
+ line-height: 1.2;
+ border-radius: 3px;
+ padding: 0.4em 0.6em;
+}