如何在logstash中获取特定日志?

如何在logstash中获取特定日志?,logstash,Logstash,我正在设置麋鹿堆栈,然后有log4j的日志 但是,我必须获得特定的日志 所以我猜编辑logstash的输出或过滤器,然后我只想得到[board.boardList]行 设置此代码需要什么 事实上,我一直在寻找网站的很多地方,但我找不到任何方法 2019-09-16 15:54:53,360 DEBUG [org.mybatis.spring.SqlSessionUtils] Creating a new SqlSession 2019-09-16 15:54:53,393 DEBUG

我正在设置麋鹿堆栈,然后有log4j的日志

但是,我必须获得特定的日志

所以我猜编辑logstash的输出或过滤器,然后我只想得到
[board.boardList]

设置此代码需要什么

事实上,我一直在寻找网站的很多地方,但我找不到任何方法

    2019-09-16 15:54:53,360 DEBUG [org.mybatis.spring.SqlSessionUtils] Creating a new SqlSession 
2019-09-16 15:54:53,393 DEBUG [org.mybatis.spring.SqlSessionUtils] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@772121a] was not registered for synchronization because synchronization is not active 
2019-09-16 15:54:53,394 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 
2019-09-16 15:54:53,394 DEBUG [org.springframework.jdbc.datasource.SimpleDriverDataSource] Creating new JDBC Driver Connection to [jdbc:oracle:thin:@127.0.0.1:1521:local] 
2019-09-16 15:54:53,483 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] JDBC Connection [oracle.jdbc.driver.T4CConnection@437df7c8] will not be managed by Spring 
2019-09-16 15:54:53,483 DEBUG [board.boardTotal] ooo Using Connection [oracle.jdbc.driver.T4CConnection@437df7c8] 
2019-09-16 15:54:53,484 DEBUG [board.boardTotal] ==> Preparing: select count(*) from bow_board b, bow_member m where b.m_no=m.m_no and (brd_subject like '%'||?||'%' or brd_content like '%'||?||'%') 
2019-09-16 15:54:53,484 DEBUG [board.boardTotal] ==> Parameters: (String), (String) 
2019-09-16 15:54:53,485 DEBUG [board.boardTotal] <== Total: 1 
2019-09-16 15:54:53,485 DEBUG [org.mybatis.spring.SqlSessionUtils] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@772121a] 
2019-09-16 15:54:53,485 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 
2019-09-16 15:54:53,487 DEBUG [org.mybatis.spring.SqlSessionUtils] Creating a new SqlSession 
2019-09-16 15:54:53,487 DEBUG [org.mybatis.spring.SqlSessionUtils] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@605e4482] was not registered for synchronization because synchronization is not active 
2019-09-16 15:54:53,487 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 
2019-09-16 15:54:53,487 DEBUG [org.springframework.jdbc.datasource.SimpleDriverDataSource] Creating new JDBC Driver Connection to [jdbc:oracle:thin:@127.0.0.1:1521:local] 2019-09-16 15:54:53,544 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] JDBC Connection [oracle.jdbc.driver.T4CConnection@4311318b] will not be managed by Spring 
2019-09-16 15:54:53,544 DEBUG [board.boardList] ooo Using Connection [oracle.jdbc.driver.T4CConnection@4311318b] 
2019-09-16 15:54:53,544 DEBUG [board.boardList] ==> Preparing: select * from (select rownum rn, a.* from (select b., m.m_nick as m_nick, (select count() from bow_board_re br where b.brd_no=br.brd_no and re_del_yn='n') as replycount, length(brd_subject) as sublength from bow_board b, bow_member m where b.m_no=m.m_no and (brd_subject like '%'||?||'%' or brd_content like '%'||?||'%') order by ref desc, re_step) a) where rn between ? and ? and BRD_DEL_YN = 'N' 
2019-09-16 15:54:53,544 DEBUG [board.boardList] ==> Parameters: (String), (String), 1(Integer), 10(Integer) 
2019-09-16 15:54:53,547 DEBUG [board.boardList] <== Total: 0 
2019-09-16 15:54:53,547 DEBUG [org.mybatis.spring.SqlSessionUtils] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@605e4482] 
2019-09-16 15:54:53,547 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 
2019-09-16 15:54:54,706 DEBUG [org.mybatis.spring.SqlSessionUtils] Creating a new SqlSession 
2019-09-16 15:54:54,706 DEBUG [org.mybatis.spring.SqlSessionUtils] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5917189a] was not registered for synchronization because synchronization is not active 
2019-09-16 15:54:54,706 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 
2019-09-16 15:54:54,706 DEBUG [org.springframework.jdbc.datasource.SimpleDriverDataSource] Creating new JDBC Driver Connection to [jdbc:oracle:thin:@127.0.0.1:1521:local] 
2019-09-16 15:54:54,769 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] JDBC Connection [oracle.jdbc.driver.T4CConnection@11267482] will not be managed by Spring 
2019-09-16 15:54:54,769 DEBUG [board.boardTotal] ooo Using Connection [oracle.jdbc.driver.T4CConnection@11267482] 
2019-09-16 15:54:54,769 DEBUG [board.boardTotal] ==> Preparing: select count(*) from bow_board b, bow_member m where b.m_no=m.m_no and (brd_subject like '%'||?||'%' or brd_content like '%'||?||'%') 
2019-09-16 15:54:54,769 DEBUG [board.boardTotal] ==> Parameters: (String), (String) 
2019-09-16 15:54:54,771 DEBUG [board.boardTotal] <== Total: 1 
2019-09-16 15:54:54,771 DEBUG [org.mybatis.spring.SqlSessionUtils] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5917189a] 
2019-09-16 15:54:54,772 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 
2019-09-16 15:54:54,774 DEBUG [org.mybatis.spring.SqlSessionUtils] Creating a new SqlSession 
2019-09-16 15:54:54,774 DEBUG [org.mybatis.spring.SqlSessionUtils] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1a1a0788] was not registered for synchronization because synchronization is not active 
2019-09-16 15:54:54,775 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 
2019-09-16 15:54:54,775 DEBUG [org.springframework.jdbc.datasource.SimpleDriverDataSource] Creating new JDBC Driver Connection to [jdbc:oracle:thin:@127.0.0.1:1521:local] 
2019-09-16 15:54:54,844 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] JDBC Connection [oracle.jdbc.driver.T4CConnection@44e4f245] will not be managed by Spring 
2019-09-16 15:54:54,845 DEBUG [board.boardList] ooo Using Connection [oracle.jdbc.driver.T4CConnection@44e4f245] 
2019-09-16 15:54:54,845 DEBUG [board.boardList] ==> Preparing: select * from (select rownum rn, a.* from (select b., m.m_nick as m_nick, (select count() from bow_board_re br where b.brd_no=br.brd_no and re_del_yn='n') as replycount, length(brd_subject) as sublength from bow_board b, bow_member m where b.m_no=m.m_no and (brd_subject like '%'||?||'%' or brd_content like '%'||?||'%') order by ref desc, re_step) a) where rn between ? and ? and BRD_DEL_YN = 'N' 
2019-09-16 15:54:54,845 DEBUG [board.boardList] ==> Parameters: (String), (String), 1(Integer), 10(Integer) 2019-09-16 15:54:54,848 DEBUG [board.boardList] <== Total: 0 
2019-09-16 15:54:54,848 DEBUG [org.mybatis.spring.SqlSessionUtils] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1a1a0788] 
2019-09-16 15:54:54,848 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 
2019-09-16 15:54:55,843 DEBUG [org.mybatis.spring.SqlSessionUtils] Creating a new SqlSession 
2019-09-16 15:54:55,843 DEBUG [org.mybatis.spring.SqlSessionUtils] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@29dd751] was not registered for synchronization because synchronization is not active 
2019-09-16 15:54:55,844 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 
2019-09-16 15:54:55,844 DEBUG [org.springframework.jdbc.datasource.SimpleDriverDataSource] Creating new JDBC Driver Connection to [jdbc:oracle:thin:@127.0.0.1:1521:local] 
2019-09-16 15:54:55,903 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] JDBC Connection [oracle.jdbc.driver.T4CConnection@7319bd07] will not be managed by Spring 
2019-09-16 15:54:55,903 DEBUG [board.boardTotal] ooo Using Connection [oracle.jdbc.driver.T4CConnection@7319bd07] 
2019-09-16 15:54:55,903 DEBUG [board.boardTotal] ==> Preparing: select count(*) from bow_board b, bow_member m where b.m_no=m.m_no and (brd_subject like '%'||?||'%' or brd_content like '%'||?||'%') 
2019-09-16 15:54:55,904 DEBUG [board.boardTotal] ==> Parameters: (String), (String) 
2019-09-16 15:54:55,905 DEBUG [board.boardTotal] <== Total: 1 2019-09-16 15:54:55,905 DEBUG [org.mybatis.spring.SqlSessionUtils] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@29dd751] 
2019-09-16 15:54:55,905 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 
2019-09-16 15:54:55,907 DEBUG [org.mybatis.spring.SqlSessionUtils] Creating a new SqlSession 
2019-09-16 15:54:55,908 DEBUG [org.mybatis.spring.SqlSessionUtils] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@66de0334] was not registered for synchronization because synchronization is not active 
2019-09-16 15:54:55,908 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 
2019-09-16 15:54:55,908 DEBUG [org.springframework.jdbc.datasource.SimpleDriverDataSource] Creating new JDBC Driver Connection to [jdbc:oracle:thin:@127.0.0.1:1521:local] 
2019-09-16 15:54:55,980 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] JDBC Connection [oracle.jdbc.driver.T4CConnection@1faeed6d] will not be managed by Spring 
2019-09-16 15:54:55,981 DEBUG [board.boardList] ooo Using Connection [oracle.jdbc.driver.T4CConnection@1faeed6d] 
2019-09-16 15:54:55,981 DEBUG [board.boardList] ==> Preparing: select * from (select rownum rn, a.* from (select b., m.m_nick as m_nick, (select count() from bow_board_re br where b.brd_no=br.brd_no and re_del_yn='n') as replycount, length(brd_subject) as sublength from bow_board b, bow_member m where b.m_no=m.m_no and (brd_subject like '%'||?||'%' or brd_content like '%'||?||'%') order by ref desc, re_step) a) where rn between ? and ? and BRD_DEL_YN = 'N' 
2019-09-16 15:54:55,981 DEBUG [board.boardList] ==> Parameters: (String), (String), 1(Integer), 10(Integer) 
2019-09-16 15:54:55,984 DEBUG [board.boardList] <== Total: 0 
2019-09-16 15:54:55,984 DEBUG [org.mybatis.spring.SqlSessionUtils] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@66de0334] 
2019-09-16 15:54:55,984 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource

您可以编写一个grok筛选器来过滤日志消息

请检查这个示例conf文件

filter{
    grok{
        match => {"message" => "%{DATESTAMP:time} %{LOGLEVEL:level} \[board.boardTotal\] %{GREEDYDATA:data}"}
    }

}

output{
    if "_grokparsefailure" in [tags] {
        # do something
    } else {
        elasticsearch{
          hosts => ["localhost:9200"]
          index => "log-with-boardtotal"

       }
    }

    stdout { 
       codec => "rubydebug"
    }
}
在上面的conf文件中,grok将与
board.boardTotal
匹配。没有
board.boardTotal
的行将在标记中有一个
\u grokparsefailure

这是一个简单的解决方案,您可以根据需要更改为。我只解析了多达
board.boardTotal


谢谢

您可以编写一个grok筛选器来过滤日志消息

请检查这个示例conf文件

filter{
    grok{
        match => {"message" => "%{DATESTAMP:time} %{LOGLEVEL:level} \[board.boardTotal\] %{GREEDYDATA:data}"}
    }

}

output{
    if "_grokparsefailure" in [tags] {
        # do something
    } else {
        elasticsearch{
          hosts => ["localhost:9200"]
          index => "log-with-boardtotal"

       }
    }

    stdout { 
       codec => "rubydebug"
    }
}
在上面的conf文件中,grok将与
board.boardTotal
匹配。没有
board.boardTotal
的行将在标记中有一个
\u grokparsefailure

这是一个简单的解决方案,您可以根据需要更改为。我只解析了多达
board.boardTotal

多谢各位