You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To test this code, start an osquery shell and find the path of the osquery extension socket:
90
93
91
-
```
94
+
```sql
92
95
osqueryi --nodisable_extensions
93
96
osquery>select value from osquery_flags where name ='extensions_socket';
94
97
+-----------------------------------+
@@ -100,20 +103,20 @@ osquery> select value from osquery_flags where name = 'extensions_socket';
100
103
101
104
Then start the Go extension and have it communicate with osqueryi via the extension socket that you retrieved above:
102
105
103
-
```
104
-
go run ./my_table_plugin.go /Users/USERNAME/.osquery/shell.em
106
+
```bash
107
+
go run ./my_table_plugin.go --socket /Users/USERNAME/.osquery/shell.em
105
108
```
106
109
107
110
Alternatively, you can also autoload your extension when starting an osquery shell:
108
111
109
-
```
112
+
```bash
110
113
go build -o my_table_plugin my_table_plugin.go
111
114
osqueryi --extension /path/to/my_table_plugin
112
115
```
113
116
114
117
This will register a table called "foobar". As you can see, the table will return two rows:
115
118
116
-
```
119
+
```sql
117
120
osquery>select*from foobar;
118
121
+-----+-----+
119
122
| foo | baz |
@@ -130,7 +133,7 @@ Using the instructions found on the [wiki](https://osquery.readthedocs.io/en/lat
130
133
131
134
### Creating logger and config plugins
132
135
133
-
The process required to create a config and/or logger plugin is very similar to the process outlined above for creating an osquery table. Specifically, you would create an `ExtensionManagerServer` instance in `func main()`, register your plugin and launch the extension as described above. The only difference is that the implementation of your plugin would be different. Each plugin package has a `NewPlugin` function which takes the plugin name as the first argument, followed by a list of required arguments to implement the plugin.
136
+
The process required to create a config and/or logger plugin is very similar to the process outlined above for creating an osquery table. Specifically, you would create an `ExtensionManagerServer` instance in `func main()`, register your plugin and launch the extension as described above. The only difference is that the implementation of your plugin would be different. Each plugin package has a `NewPlugin` function which takes the plugin name as the first argument, followed by a list of required arguments to implement the plugin.
134
137
For example, consider the implementation of an example logger plugin:
135
138
136
139
```go
@@ -224,7 +227,7 @@ If you write an extension with a logger or config plugin, you'll likely want to
224
227
1. Build the plugin. Make sure to add `.ext` as the file extension. It is required by osqueryd.
0 commit comments