vim-loggly-search


Ⅰ. 插件描述

A vim plug-in to easily search in loggly

Ⅱ. 基本信息

创建日期:  2016-11-19
使用用户:  1
Github星:  1
插件作者:  Christian Rondeau

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'christianrondeau/vim-loggly-search'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'christianrondeau/vim-loggly-search'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'christianrondeau/vim-loggly-search'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/christianrondeau/vim-loggly-search

Ⅳ. 文档说明

# 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

添加新评论