GithubHelp home page GithubHelp logo

christianrondeau / vim-loggly-search Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 17 KB

A vim plug-in to easily search in loggly

License: MIT License

Vim Script 100.00%
vim-plugin vim-scripts loggly vim

vim-loggly-search's Introduction

Vim Loggly Search

Searches for the visually selected text in Loggly.

Installation

Prerequisites

  • A Loggly account
  • Requires curl to be installed and in the PATH.

Plugin

Use your preferred Vim plugin installation method. If you like vim-plug:

Add to your .vimrc:

Plug 'christianrondeau/vim-loggly-search'

And install it:

:PlugInstall

Basic Configuration

You also need to assign these variables in your .vimrc:

" Your <account>.loggly.com
let g:loggly_account = "account_name"

" Either:
"  * --netrc-file path-to-netrc-file (see https://ec.haxx.se/usingcurl-netrc.html)
"  * -u username:password
"  * -H "Authorization: bearer YOUR-LOGGLY-TOKEN" (see https://mediaclip.loggly.com/account/users/api/tokens)
let g:loggly_curl_auth = '-H "Authorization: bearer 00000000-0000-0000-0000-000000000000"'

Windows

Usage

Type <leader>loggly to start a search and show results in a new split buffer. It also will automatically prepopulate the search when using the shortcut in visual mode. It remembers the last search.

You can use the command :LogglySearch "my search query" if you prefer.

Mapping

You can create your own mapping if you want:

map <leader>log <Plug>LogglySearch

You can also create maps for searches you do often:

nnoremap <leader>errors :LogglySearch "json.level:ERROR"<cr>

Settings

let g:loggly_default_from = "-1h"
let g:loggly_default_until = "now"
let g:loggly_default_size = "100"

Find more using :help loggly-search

Extending

You can call arbitrary code after the resut is returned in the buffer, e.g.:

let g:loggly_filter = "call MyLogglyFilter()"

function! MyLogglyFilter()
  " Keep only messages
  v/"message"/d
  %s/\v^ *"message": "//
  %s/\v"$,?//
endfunction

LICENSE

Copyright (c) 2016 Christian Rondeau, under MIT license

vim-loggly-search's People

Contributors

christianrondeau avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.