Github user d2r commented on a diff in the pull request:
https://github.com/apache/storm/pull/822#discussion_r43398781
--- Diff: storm-core/src/clj/backtype/storm/daemon/logviewer.clj ---
@@ -294,9 +418,55 @@ Note that if anything goes wrong, this will throw an
Error and exit."
(resp/status 404))
(unauthorized-user-html user))))
+(defn daemonlog-page [fname start length grep user root-dir]
+ (if (or (blank? (*STORM-CONF* UI-FILTER))
+ (authorized-log-user? user fname *STORM-CONF*)) ;; how to deal
with this???????????
+ (let [file (.getCanonicalFile (File. root-dir fname))
+ file-length (.length file)
+ path (.getCanonicalPath file)
+ zip-file? (.endsWith path ".gz")]
+ (if (and (= (.getCanonicalFile (File. root-dir))
+ (.getParentFile file))
+ (.exists file))
+ (let [file-length (if zip-file? (Utils/zipFileSize
(clojure.java.io/file path)) (.length (clojure.java.io/file path)))
+ length (if length
+ (min 10485760 length)
+ default-bytes-per-page)
+ log-files (into [] (filter #(.isFile %) (.listFiles (File.
root-dir)))) ;all types of files included
+ files-str (for [file log-files]
+ (.getName file))
+ reordered-files-str (conj (filter #(not= fname %) files-str)
fname)
+ is-txt-file (re-find #"\.(log.*|txt|yaml|pid)$" fname)
--- End diff --
We might have pulled this out into its own function, since it is used at
least twice now. Not a big deal though.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---