snaketail-net icon indicating copy to clipboard operation
snaketail-net copied to clipboard

Automatic detection and handling of URLs in log files

Open jasonchester opened this issue 9 years ago • 6 comments

Given a line in a log file such as

8976 12:21:01 INFO  SearchService::Search() statusCode=OK method=GET time=00:00:00.1556982 uri=http://stgapi.dummyappy.com/v2/Search/pollo?SiteId=90&LanguageId=2&pageNo=1&pageSize=12&scope=articles

A link such as http://stgapi.dummyappy.com/v2/Search/pollo?SiteId=90&LanguageId=2&pageNo=1&pageSize=12&scope=articles should be automatically:

  • styled as a link with underlines and color
  • clicking should open the default browser or sent to a program of the users choice
  • right-clicking should open a context menu with the options ** Copy Link ** Open Link in Default ** Open Link In Custom

jasonchester avatar Mar 24 '15 16:03 jasonchester

Guess you could register an external tool, that gets the line-text as input-parameter, and then it could scan for any http-links and open them in whatever browser.

You could probably highlight lines that contains http-links, but it would be the entire line-text and not just the http-link.

snakefoot avatar Mar 24 '15 18:03 snakefoot

Since you are already allowing for a regex to highlight lines, enhancing that functionality to allow you to use the regex to capture the output and send pieces of the line to an external tool shouldn't be too hard.

Having them underlined and clickable is certainly a nice to have as opposed to being able to launch them directly into the browser.

Introducing a whole new tool to split the log line and open the browser or changing the format of the log statements so that URLs are on dedicated lines isn't going to be an option for 90% of your user base.

jasonchester avatar Apr 06 '15 18:04 jasonchester

Is there any way of seing an example on how to set up an "external tool" in the configure view. I would so like to enhance the tail experiance with some colorizing, and possible alerts and hyperlinking aswell.

Anyone have any pointers for me? What kind of tool is an external tool? Can i make my own tool, in PHP or Node or grunt?

Anyone seem a website or blog where they write about configuring?

steinhaug avatar Apr 14 '18 11:04 steinhaug

An external tool is any exe-file with some parameters. So you can run a batch-file / cmd-file using cmd.exe, or you can run a powershell-script with the powershell-exe.

snakefoot avatar May 01 '18 23:05 snakefoot

Re; snakefoot:

"An external tool is any exe-file with some parameters. So you can run a batch-file / cmd-file using cmd.exe, or you can run a powershell-script with the powershell-exe."

HOW TO CONFIGURE EXTERNAL TOOL FOR AUDIBLE KEYWORD TRIGGER

(External Tool Summary Example; PROPER SYNTAX IS THE GOLDEN RULE HERE PEEPS!):

Reference Article https://github.com/snakefoot/snaketail-net/issues/111#issuecomment-385833945

Ironwolfe avatar May 02 '18 01:05 Ironwolfe

LOL!!! I was just spending some time in my study (bathroom) and had a potentially paradoxial concept regarding the use of external tools and audible alerts for ST:

"Text-to-Speech" software might just be advanced enough these days to consider the following experiment:

1. Create a blank .txt file and save it as "TESTLOG.TXT"

2. Open ST and enter configuration menus: Add and configure two separate external tools:

A. For "External Tool" no.1: Add and configure a lightweight Text-to-Speech application that accepts runtime variables for executing and file creation). Name this tool TXTWAV B. For "External Tool" no.2: Add and configure a lightweight audio file player such as VLC (mentioned earlier in thread/how-to). Name this tool PLAYWAV

3. Configure ST sessions (or default config) with a desired keyword trigger of your choice - BUT - add the same keyword twice on your keyword list. (example:

keyword1 = word keyword2 = word

4. Edit Your Keyword"s":

A. In the keywords config list: Select "Launch External Tool" checkbox option for your keyword instance that is listed at TOP of the keywords list and choose "TXTWAV". B. In your "keywords" config list: Select "Launch External Tool" checkbox option for your same keyword instance that is listed at BOTTOM of the keywords list and choose "PLAYWAV".

5. Open your testlog file inside ST, type your keyword into your testlog file via notepad.exe, and save/refresh the file for ST processing ;>

Ironwolfe avatar May 02 '18 02:05 Ironwolfe